AwoCoupon Free


Table of Contents
1. Introduction
2. Installation
3. Using the Software - Administration
     3.1 Getting Around
     3.2 Configuring a Coupon
4. Example Usage
     4.1 Example 1
     4.2 Example 2
     4.3 Example 3
     4.4 Example 4
5. Troubleshooting
Introduction
AwoCoupon for Virtuemart was created to fill a void and make Virtuemart Coupons easy to use and manage. Although Virtuemart has coupon capabilities, they are not extensive enough to cover what many people would call basic coupon features. AwoCoupon for Virtuemart fills this gap. Some of its features include:
  • Product(s) specific discounts
  • Customer(s) specific discounts
  • The ability to only trigger coupons if a minimum cart total is reached
  • Ability to set expiration dates for coupons
  • Restrict the number of times a coupon can be used by any given user
  • Easy management of all coupons
  • Gift coupons
Installation
Backup your code before starting the installation process. Please read through the instructions carefully.

System requirements
Joomla 1.5 and up
Virtuemart 2.x and up
PHP 5
Install
1.   Download AwoCoupon for Virtuemart to a location on your computer
2.   Log into Joomla as an Administrator
3.   From the top menu choose Extensions->"Install/Uninstall"
4.   Under the "Upload Package File" section press the "Browse..." button
5.   Find and select the file, com_awocoupon.zip, downloaded to your computer
6.   Install component by pressing "Upload File & Install" button
7.   You will receive a page telling you the status of the installation.
8.   Verify "VMCoupon - AwoCoupon" Plugin is eanbled

Note, once installed, make sure coupons are enabled within Virtuemart configuration before trying to use. If it is not enabled, the coupon box will not appear in the cart.

This is a 2 step process. First the component is installed, then the virtuemart source code is edited. If the second part of the installation is not completed for some reason then knowledge of php code as well as write access to your joomla source code will be needed. Please read through the instructions carefully.
System requirements
Joomla 1.5, Virtuemart 1.1.2 to 1.1.9
Step 1 – Virtuemart Coupon
1.   Download AwoCouon for Virtuemart to a location on your computer
2.   Log into Joomla as an Administrator
3.   From the top menu go to Extensions->"Install/Uninstall"
4.   Under the “Upload Package File" section press the button "Browse…"
5.   Find and select the file, com_awocoupon.zip, downloaded to your computer
6.   Install component by pressing "Upload File & Install" button
7.   You will receive a page telling you the status of step 1 and step 2. If step 2 was successful, you are done, if not, please follow instructions below for step 2. (if unsuccessful, see Section 7. Troubleshooting)
Step 2 – Virtuemart Injection (ONLY if Unsuccessful)
This section requires the user to have access to the website files for edit. You may need to use an ftp client to access the files.
1.   Open the file $webroot/administrator/components/com_virtuemart/classes/ps_coupon.php
2.   Right after these lines (around line 158):
PHP Code:
                                            <span style="color:#000000;">
                                        
                                                <span style="color:#FF8000;">/* function to process a coupon_code entered by a user */</span>
                                                <span style="color:#007700;"><br>function</span>
                                                <span style="color:#0000BB;">process_coupon_code</span><span style="color:#007700;">( </span>
                                                <span style="color:#0000BB;">$d </span>
                                                <span style="color:#007700;">) {</span>
                                            </span>
                                        
      Enter the following code:
PHP Code
                                            <span style="color:#000000;">
                                                <span style="color:#007700;">return require_once (</span><span style="color:#0000BB;">JPATH_ADMINISTRATOR</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"components"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"com_awocoupon"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"assets"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"virtuemart"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"ps_coupon_process.php"</span><span style="color:#007700;">);</span>
                                
                                            </span>
                                        
3.   Right after these lines (around line 135):
PHP Code:
                                            <span style="color:#000000;">
                                        
                                                <span style="color:#FF8000;">/* function to remove coupon coupon_code from the database */</span>
                                                <span style="color:#007700;"><br>function</span>
                                                <span style="color:#0000BB;">remove_coupon_code</span><span style="color:#007700;">( </span>
                                                <span style="color:#0000BB;">&$d </span>
                                                <span style="color:#007700;">) {</span>
                                            </span>
                                        
      Enter the following code:
PHP Code:
                                            <span style="color:#000000;">
                                                <span style="color:#007700;">return require_once (</span><span style="color:#0000BB;">JPATH_ADMINISTRATOR</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"components"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"com_awocoupon"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"assets"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"virtuemart"</span><span style="color:#007700;">.</span><span style="color:#0000BB;">DS</span><span style="color:#007700;">.</span><span style="color:#DD0000;">"ps_coupon_remove.php"</span><span style="color:#007700;">);</span>
                                
                                            </span>
                                        
Using the software - Administration
Now that we have finished the installation, we can look closely at the features presented in this application.
Getting Around
Log into the administration screen and go to Components » AwoCoupon. Here you will see the control panel. It shows the general statistics of what coupons you currently have configured as well as a couple of menus. From here you can enter a new coupon or view the entries of coupons you have.
Configuring a Coupon
To add a new coupon, select "New Coupon" from the control panel, or from the coupons list "New".
Fields:
Coupon Code enter a unique coupon code of up to 32 characters
Published Options
    Published: active coupon
    Unpublished: inactive coupon
Function Type Options
    Coupon: used as a normal coupon. If number of uses is set to 2, then all users can use the coupon a total of 2 times each.
Number of uses 
    Options
        Per Customer: treats the number of uses as per user
        Total: treats the number of uses as a total across all users
    Number: the number of times a coupon can be used. If set to 0 or is left blank, there is no limit.
Percent or Total Options
    Percent: coupon takes a percent of value
    Total: coupon is an actual figure that is subtracted from total
Discount Type Options
This option can only be used if a product is selected AND the Percent or Total field is selected as a Percent. Otherwise it defaults to "Overall".
    Overall: The discount is calculated as a percentage of the overall total in the shopping cart
    Specific: The discount is calculated as a percentage of the total of the products configured in the coupon that are in the shopping cart
Value Number: this is the value of the coupon and is dependent on the Percent or Total field to determine how it is calculated
Minimum Value Number: this is the minimum value of the shopping cart before this coupon can take effect. If set to 0 or is left blank, then there is no minimum value
Expiration Date: the date the coupon expires. If left blank, then it never expires.
Customers A multiple select box of all your Virtuemart customers. Selection of customers will activate the coupon only for those customers.
Products A multiple select box of all your Virtuemart products. Selection of products will limit the activation of the coupon to those specific products.
Example Usage
The customer and product field are multiple selection boxes. So you can select none, one, or multiple customers and/or products for every coupon configured.
Example 1
Coupon Code: COUPONCODE
Published: Published
Function Type: Coupon
Number of Uses: 1
Percent or Total: Percent
Discount Type: Overall
Value: 25
Minimum Value: blank
Expiration: blank
Customer: None chosen
Products: None chosen
This coupon will work for all products and all customers (including any new registrations) for exactly 1 time per customer. It will take 25% off the total value of the shopping cart. The coupon never expires. The customer is required to have an account to be able to use this code.
Example 2
Coupon Code: COUPONCODE
Published: Published
Function Type: Coupon
Number of Uses: blank
Percent or Total: Value
Discount Type: Overall
Value: 25
Minimum Value: 100
Expiration: 2020-10-17
Customer: 2 chosen
Products: 3 chosen
This coupon will work for the 2 customers chosen as long as their shopping cart total has a minimum total of 100 and at least one product in the cart is one of the 3 chosen in the coupon. It is a permanent coupon so it will work everytime used as long as the criteria are met. The coupon will become invalid on October 17, 2020.
Example 3
Coupon Code: COUPONCODE
Published: Published
Function Type: Coupon
Number of Uses: 3
Percent or Total: Percent
Discount Type: Specific
Value: 20
Minimum Value: 120
Expiration: blank
Customer: 7 chosen
Products: 3 chosen
This coupon will work for the 7 customers chosen as long as their shopping cart has a minimum total of 120 and at least one product in the cart is one of the 3 chosen in the coupon. Since the discount type is set to specific, 20% will only be deducted from the value of the product set in the coupon. If the customer has all 3 products, 20% will be deducted from all 3 products. Each of the customers selected can use this coupon a total of 3 times. Since it has no expiration date, it never expires, but with the restrictions set, it effectively expires after all 7 customers use the coupon on 3 seperate occasions each.
Example 4
Coupon Code: COUPONCODE
Published: Published
Function Type: Coupon  
Number of Uses: 1 Total
Percent or Total: Total
Discount Type: Overall
Value: 5
Minimum Value: blank
Expiration: blank
Customer: blank
Products: blank
This coupon will work exactly like a gift coupon. Anybody can use it (an account is not required) and it will work for exactly 1 time. Once used, it becomes invalid.
Troubleshooting
Please contact the forum with specific question.