Custom variables provide additional flexibility to your pricing plans. The variables are made available in the theme files so you can use them for customizations. For example, you can show/hide specific page elements based on the variables that are included in the plan.
To set custom variables, edit your pricing plans and in the Advanced tab add the variable name and variable value in this format:
To access the custom variables use this code:
<?php echo $Paid->getVar('var1',$listing);?>
Let's say you created 3 plans: Free, Basic and Premium.
For each of those plans you can set a variable with the same name, but different value, for example:
In the Free plan enter this:
plan_type|free
In the Basic plan enter this:
plan_type|basic
In the Premium plan enter this:
plan_type|premium
Then in the theme files (i.e. /listings/detail.thtml) you can create conditionals like this:
<?php if ($Paid->getVar('plan_type',$listing) == 'free'): ?>
This is a free listing.
<?php elseif ($Paid->getVar('plan_type',$listing) == 'basic'): ?>
This is a basic listing.
<?php elseif ($Paid->getVar('plan_type',$listing) == 'premium'): ?>
This is a premium listing.
<?php endif;?>
Listings that have the Free plan would output "This is a free listing.", listings that have the Basic Plan would output "This is a basic listing.", etc.
This way you can show/hide different parts of theme files based on the custom variable value.
Let's say you want to show the inquiry form on listing detail pages, but only for listings whose owners purchased the Premium plan.
In the Premium plan you can add a custom variable like this:
inquiry|enabled
In the theme file of the listing detail page (/listings/detail.thtml) you can add this code:
<?php if ($Paid->getVar('inquiry',$listing) == 'enabled'): ?>
<?php echo $this->element('inquiry_widget');?>
<?php endif;?>
This code would display the inquiry form only in listings whose owners purchased the plan that contains the inquiry custom variable.
To use this approach for the Inquiry Form, you first need to disable the default inquiry functionality in JReviews Configuration, Listings tab. You need to set Enable Listing Inquiries to No.
If you want your users to submit listings for free but charge them for additional features like making the listing Featured, adding additional custom fields, ..., it is still required that you create a base plan because upgrade plans are not available if a base plan is not applied to a listing.
In this case you must create only one base plan and select Free or Trial as Payment type.
Make the plan default, and if you set Show in submit form to No, users will not see the plan when submitting a listing, but this free plan will be processed automatically.
This will make it possible for listing owners to Order Upgrade and pay only for special features that you created as listing upgrades.
Existing Listings (using bulk order generator)
If you create a listing plan for a category that already has listings (created before listing plans were available), all media and custom fields will be hidden in those existing listings.
For existing listings you need to create a free base plan that will include the images and custom fields.
When you save the free listing plan, you will see a Create orders button next to the plan. When you click this button, it will generate orders and apply this free plan to all existing listings that don't have a plan:
When you create pricing plans for certain categories, it will not be possible to submit listings without ordering and paying for submission to those categories.
To allow certain users (administrators) to submit a listing without payment, you can create a Coupon with 100% discount.
Here is an example of the coupon settings:
The name of the coupon is the actual coupon code that the admins will need to use when ordering a plan.
Discount is set to 100 and in Restrict to Users only the administrator (Super User) is selected.
When submitting a listing, administrator will need to select a plan, and later enter the coupon code when confirming the order.
It is possible to filter the output of the modules and even the JReviews Custom List menu by adding a CUSTOM WHERE statement that looks like this:
(Listing.id IN (SELECT DISTINCT listing_id FROM #__jreviews_paid_orders WHERE order_active = 1 and plan_id = 5))
If you want to match multiple plans the statement can be written like this:
(Listing.id IN (SELECT DISTINCT listing_id FROM #__jreviews_paid_orders WHERE order_active = 1 and plan_id IN (4,5,6)))
Make sure you change the plan_id(s) to match the ids of your paid plans.