Announcement

Collapse
No announcement yet.

Can I use coupon codes for free shipping?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can I use coupon codes for free shipping?

    This workaround will allow buyers to use coupon codes to avail free shipping on their orders

    PLEASE NOTE: This technique is fairly advanced and requires editing of the software's Perl scripts. It is unsupported by SellerDeck; if the procedure fails then SellerDeck default scripts can be found within a folder called 'Original' within your SellerDeck installation.

    The discount can be set up using Order Level or Cart Content Discounts. Both options are listed below followed by the changes to be made in the relevant Perl file(s).

    A. Using Order Level Discount
    1. 'Marketing | Discount, surcharges and Coupons | Order Level', click 'New' to create a new discount.
    2. Choose any value for 'Based on' and 'Type'
    3. Enable 'Requires Coupon Code' and enter a value. (Please note this value as you need to enter the exact phrase in the perl code change mentioned below)
    4. In the 'Triggers' grid, enter 0.01 for Cart Value and leave Amount/Percentage at 0.00


    B. Using Cart Content Discount (if free shipping is to be allowed on specific product group(s) alone)
    1. 'Marketing | Discount, surcharges and Coupons | Cart Contents', click 'New' to create a new discount.
    2. Choose any value for 'Based On', and for 'Trigger' enter 0.01 (or if 'Quantity' is selected leave it set to 1)
    3. Enable 'Requires Coupon Code' and enter a value. (Please note this value as you need to enter the exact phrase in the perl code change mentioned below)
    4. Under 'Product Group', select the group for which free shipping will be offered.
    5. Set 'Reward Type' as £ Off and enter a 'Reward amount' of 0.01

    Note : For Cart Content Discount see 'CART CONTENTS' in the code section below. This procedure also needs to be carried out to avoid setting the cart total to zero.

    Once discount(s) is/are set in the application, following changes need to be made in the script file 'ShippingTemplate.pl'.

    If using Simple Shipping -
    1. Open 'ShippingTemplate.pl' ('Actinic vX\Sites\<Site folder>\ShipControl' *) in a text editor such as Notepad. Find the line :

      sub ValidatePreliminaryInput.

      It will have this code under it :


      Code:
      # If it's simple shipping then just return.  Simple shipping has no preliminary
                      #             input.
                      #
                      if ($ShippingBasis eq 'Simple')                                                                    # if simple shipping
                                      {
                                      return($::SUCCESS, undef);
                                      }
    2. Replace the code with: -

      Code:
      # If it's simple shipping then just return.  Simple shipping has no preliminary
                  #          input.
                  #
                  if ($ShippingBasis eq 'Simple')                                                      # if simple shipping
                              {
                  if($::g_PaymentInfo{'COUPONCODE'} eq 'FREE')     # Trying for freedelivery off coupon
                  {
                              my @Response = ActinicDiscounts::ValidateCoupon($::g_PaymentInfo{'COUPONCODE'});
                              if ($Response[0] != $::FAILURE)
                                          {
                                                      return(SetFreeShipping());
                                          }
                  }
                              return($::SUCCESS, undef);
                              }
    3. Save the file and upload the site.


    If using Advanced Shipping -
    1. Open 'ShippingTemplate.pl' ('Actinic vX\Sites\<Site folder>\ShipControl' *) in a text editor such as Notepad. Find the line :

      Code:
      if($::s_sDeliveryCountryCode eq $ActinicOrder::REGION_NOT_SUPPLIED)
      		{
      		return(SetDefaultCharge());
      		}
    2. Immediately after this code, paste the following lines :

      Code:
      # Trying for freedelivery off coupon
      	if($::g_PaymentInfo{'COUPONCODE'} eq 'FREE')
      	{
      		my @Response = ActinicDiscounts::ValidateCoupon($::g_PaymentInfo{'COUPONCODE'});
      		if ($Response[0] != $::FAILURE)
      			{
      				return(SetFreeShipping());
      			}
      	}
    3. Save the file and upload the site.


    If you wish to use multiple coupon codes for free shipping, use the following code instead of the one given above :

    For Simple Shipping:
    1. replace this code :

      Code:
      # If it's simple shipping then just return.  Simple shipping has no preliminary
                      #             input.
                      #
                      if ($ShippingBasis eq 'Simple')                                                                    # if simple shipping
                                      {
                                      return($::SUCCESS, undef);
                                      }
    2. with: -

      Code:
      # If it's simple shipping then just return.  Simple shipping has no preliminary
                  #          input.
                  #
                  if ($ShippingBasis eq 'Simple')                                                      # if simple shipping
                              {
      # FREE DELIVERY COUPONS - for an array of coupons
      	my @freedeliverycoupons = ('Free1','Free2','Free3');
      
      	sub in_array
      	{
      	my ($freedeliverycoupons,$search_for) = @_;
      	my %items = map {$_ => 1} @$freedeliverycoupons;
      	return (exists($items{$search_for}))?1:0;
      	} 
      	
      	if(in_array(\@freedeliverycoupons,$::g_PaymentInfo{'COUPONCODE'}))
      	{
      		my @Response = ActinicDiscounts::ValidateCoupon($::g_PaymentInfo{'COUPONCODE'});
      		if ($Response[0] != $::FAILURE)
      			{
      				return(SetFreeShipping());
      			}
      	}
                                     return($::SUCCESS, undef);
                              }
    3. Save the file and upload it.


    For Advanced shipping
    1. immediately after :

      Code:
      if($::s_sDeliveryCountryCode eq $ActinicOrder::REGION_NOT_SUPPLIED)
      		{
      		return(SetDefaultCharge());
      		}
    2. add these lines :

      Code:
      # FREE DELIVERY COUPONS - for an array of coupons
      	my @freedeliverycoupons = ('Free1','Free','Free3');
      
      	sub in_array
      	{
      	my ($freedeliverycoupons,$search_for) = @_;
      	my %items = map {$_ => 1} @$freedeliverycoupons;
      	return (exists($items{$search_for}))?1:0;
      	} 
      	
      	if(in_array(\@freedeliverycoupons,$::g_PaymentInfo{'COUPONCODE'}))
      	{
      		my @Response = ActinicDiscounts::ValidateCoupon($::g_PaymentInfo{'COUPONCODE'});
      		if ($Response[0] != $::FAILURE)
      			{
      				return(SetFreeShipping());
      			}
      	}
    3. Save the file, and upload the site.



    CART CONTENTS
    1. If using Cart Contents Discount, in addition to the ShippingTemplate.pl modification, edit: -

      ActinicDiscounts.pm

      and find this line:

      Code:
      # Now add it to the list of adjustments
    2. Add the following lines immediately after the above:

      Code:
      #give me back the penny as i only want to give free delivery
      
      if($::g_PaymentInfo{'COUPONCODE'} eq 'YOURCOUPON')
      {
      my @Response = ActinicDiscounts::ValidateCoupon($::g_PaymentInfo{'COUPONCODE'});
      if ($Response[0] != $::FAILURE)
      {
      if ($nAdjustment == -1){
      $nAdjustment = 0;
      }
      }
      }
    3. Save the file.

    Upload the site after making these changes and you should now be able to get free shipping based on the discount criteria.

    PLEASE NOTE: If you wish to undo any changes and revert to the SellerDeck original scripts you can find the unchanged files in ‘Program Files\Actinic vxx\Original folder’ **. Simply copy the required Perl script file(s) into the site folder.

    * Depending on the installation option chosen or operating system used, the 'Site' folder can be found in either 'My Documents', 'Documents', 'Shared Documents' or 'Program Files' in the folder 'Actinic vX\Sites\' (with X replacing the version number).
    ** Where xx is replaced by the version number. Note: All versions after v11.03 will have a file path of 'C:\Program Files\SellerDeck xxxx'.

    Thanks to Ben Adcock ( http://community.sellerdeck.com/member.php?u=2093 ) for the workaround.
Working...
X