| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Free Gifts Module for x-cart v4.1.8 | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Free Gifts Module for x-cart v4.1.8
I intended on adding this post to the end of the original thread located here.
But doing so may lead to confusion with the older v3.4 and v4.0 code of that thread. First of all, giving credit where credit is due. Kudos to MonkeyClan, the original poster of this great Mod and to all those that contributed. This module is basically the same as MonkeyClan's post but was modified for x-cart v4.1.8 As stated in the original post which was for x-cart v3.4.14 and v4.0.12, this module basically allows the store administrator to define "Free Gifts" that are offered to the customer if they spend a certain amount of money. This module also has the added feature called 'Notification Price' that tells the customer that if they spend $XX more, they'll get a free gift. STEP 1 In the administrator side, we place a menu item called 'Free Gifts' in the Inventory menu under the 'Coupons' menu item. Find the following line of code in skin1/provider/menu.tpl: Code:
Code:
WARNING: always make a backup of your database before making any changes to it! Now, using phpMyAdmin or any other way; create the 'x-cart_freegifts' table to your x-cart database. Code:
We now create a file by copying the following code, and saving it as xcart/include/func.php Code:
Now create another file for handling all the administration modifications to the Free Gifts by saving it as xcart/provider/freegifts.php Code:
STEP 5 Now open the file skin1/single/home.tpl and find the following line of code Code:
Code:
contiued on next post...
__________________
X-CART Gold v4.1.8 |
|||||||
#2
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
...continued from previous post
STEP 6a Create another file by using the code below and saving it as skin1/provider/main/freegifts.tpl Code:
Go to Languages in the administration area and create two language variables. Create a label variable and name it: lbl_free_gifts and the content as: Code:
txt_freegifts_note and the content as: Code:
This takes care of the code required for the administration area. It is a good idea now to test this part of the code to make sure that no mistakes were made and to add a couple of products to the Free gifts module. Just click on the 'Free gifts' menu item under the 'Inventory' menu to see what it looks like. If you don't see the 'Free gifts' menu item then just type cleanup.php in the address bar and the menu item will show up. Before I added a product to the Free Gifts module I created a new category in the 'Categories' area and named it 'Free Gifts'. I then clicked NO on the dropdown on the very right were it says 'Enabled'. This prevents the Free Gift category from being displayed in the storefront. Then I went to the product menu and set the price to 0 for the free gift and changed the main category to 'Free gifts'. And from there I went to the Free Gifts module and added the product. You can see what the product id is by hovering your cursor over the product hyperlink and you can see the product id on the bottom of the screen in the information bar. Or you can click on the product link and you can see the product id at the top on your address bar. continued on next post...
__________________
X-CART Gold v4.1.8 |
|||||||
|
#3
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
...continued from previous post
Now we continue to do the coding for the customer side. STEP 7 This is the promotion text and adjust the text if needed for your site design. This text will show up in your 'view cart' page below the checkout button when you have an item in your cart. Open the file skin1/customer/main/cart.tpl and find: Code:
Code:
Add the following code to xcart/cart.php near the top of the file find the line Code:
and add the following code after the line Code:
Code:
Code:
Code:
Code:
Changes need to be made to skin1/customer/main/product.tpl to show the word FREE! instead of a text input field when the price is 0.00. Find the line of code: Code:
Code:
Code:
Code:
Code:
Code:
continued on next post...
__________________
X-CART Gold v4.1.8 |
|||||||
#4
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
...continued from previous post
STEP 10 To make sure that the quantity input field doesn't show up if it's a free gift, we have to modify the skin1/customer/main/cart.tpl file findthis code Code:
Code:
END OF CODE Whew....And that's it. The last couple of days I started playing around with this code with no intentions of actually completing this project. But I got so involved in implementing this code for x-cart v4.1.8 I decided to complete all original 10 steps of the original post. This modification of mine is by no means complete. It's a starting point for others to continue adding, deleting or modifying. Although I have tested it and it's working great and have found no problems, I'm sure that many more things can be done to improve this mod for v4.1.8 Have fun. - MoonDog -
__________________
X-CART Gold v4.1.8 |
|||||||
#5
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
Wow - I can't wait to try this later - just what we needed - thanks for sharing your code and all of your hard work.
__________________
X-Cart 4.7.12 (Live) Redux Template CDSEO |
|||||||
#6
|
|||||||||
|
|||||||||
Re: Free Gifts Module for x-cart v4.1.8
thank you I will try it also
__________________
Web Design Web Design and Custom X-Cart Projects http://www.dataviking.com Mention the forums for discounts! x-cart Version 4.1.8 |
|||||||||
#7
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
I edited the very last line of step 9.
It it correct now and should only have the {/if} statement. I inadvertently had some javascript placed at the end of step 9 that should not be there. - MoonDog -
__________________
X-CART Gold v4.1.8 |
|||||||
#8
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
This works great apart from 1 error 1 get when changing a minimum price on the free gift item.
If you change the price and hit update I get the following error Fatal error: Call to undefined function: func_update_free_gift_minimum_price() in /home/website/public_html/provider/freegifts.php on line 53 Any ideas?
__________________
X-Cart 4.7.12 (Live) Redux Template CDSEO |
|||||||
#9
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
Another problem I get is that the part of the system that is supposed to say "spend another ёx to receive a free gift" does not work on my site.
Apart from that works just fine.
__________________
X-Cart 4.7.12 (Live) Redux Template CDSEO |
|||||||
#10
|
|||||||
|
|||||||
Re: Free Gifts Module for x-cart v4.1.8
01bodyjewellery,
In xcart/provider/freegifts.php find this line: Code:
and modify by removing '_minimum' from this line of code. It should look like this: Code:
Quote:
- MoonDog -
__________________
X-CART Gold v4.1.8 |
|||||||
|
|||
X-Cart forums © 2001-2020
|