Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get 1 Free


kymation

Recommended Posts

This contribution allows you to promote a product by giving a free product when

the customer buys a specified number of the product you are promoting. This is

commonly used for a "buy two, get one free" promotion, but it is more versatile

than that:

* The qualifying quantity of the product you are promoting can be any number,

including one.

* The free product can be the same as the promoted product or any other product

in your catalog.

* You can limit the free product to one per order or any number that you wish.

* Like specials, you can set a date for the offer to expire.

* You can have any number of products in this promotion with different

requirements for each.

 

The free product is automatically added to the customers shopping cart when they

purchase a qualifying product in the qualifying quantity (or more.) The free

product is removed when the customer removes the qualifying product from their

cart or reduces the quantity below the qualifying quantity. The customer cannot

increase the number of free products without qualifying for them. It's designed

to be fairly foolproof.

 

Here's the Contribution page.

Edited by kymation

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hiya Jim, thanks for this great contrib, just saw it coming through on my RSS feed, I'm sure it will be a great asset to any site... Once I get it installed sometime within the next week, will give you feedback on it...

 

Check for it to be installed in my online shop here

 

 

Riaan

Link to comment
Share on other sites

Jim, I installed it, and all looks well... It adds the free product in the shopping cart at 0.00, so that bodes well...

 

My question to you is this, if you do look at my shop, this link, that's where I added it, just added another Toshiba notebook to it to test...

 

1. You say in the readme that currently it will not display on the main product which products you will get, mind if I give you an idea and you think about it? Would it be possible to edit product_info.php to check for freebies for the main product, and maybe just add a line (pointing to the freebie) that buying X amount of this product will get you Y amount of he freebie? ----- Scrap that idea! -- Maybe link that says, "Click here to find out what freebies you get with this product", and clicking it will open a popup linked to the freebie product's info (pulled from product_info.php) for the freebie product.

 

2. If you look at my store, 99% of all my products will eventually have attributes attached to them. Maybe it can be done that a freebie product can be allocated certain attributes to it when it is given as a freebie for another product. Sounds crazy, but if i sold a Qosmio notebook, I wouldn't want to give a standard black mousepad with it, but the main freebie(mousepad) in a silver(attribute of mousepad)...

 

Hope this will get you thinking!

 

Cheers again for a great contrib!

Link to comment
Share on other sites

First problem, not sure if problem but needs to be confirmed

 

When the main product is removed from the cart, the freebie remains. In all fairness it does put the correct price on it, but shouldn't it be linked to the main product and also removed? [Puts on client thinking cap]Can just see a few clients adding a main product to the cart, later remove it and then find out that when they confirmed their order and obviously didn't check their cart, that they got billed for extra items which they did not want...

Link to comment
Share on other sites

Great contribution! :thumbsup:

 

Just one question... is it possible to specify a multiple of the free product per promotion?

 

for example: buy 4 get 2 free, BUT NOT buy 2 get 1...

 

thanks again - easy install & works great.

Link to comment
Share on other sites

Second Problem, this is definitely a problem

 

Jim, the multiplier doesn't work... Tried making it 2 M400-139 freebies for buying 1 Qosmio, but it only adds it to the cart as 1...

 

---------------------------

Mira has a great idea!

Link to comment
Share on other sites

Wow -- I never expected this number of comments this fast. Looks like a lot of you were looking at the RSS feed. I'll try to answer everybody in one place here. Feel free to post again if I didn't answer yours properly.

 

I thought of adding something to the product page as advertisement (and the link to the free product is a good idea.) However, I've had Contributions that never got posted due to feature creep, so I gave up and just put this one up without it. This is definitely on the wish list for a future update. You can always just add some text to the product page as a workaround.

 

Attributes is another problem. This just takes so long to code that I went without it. As a workaround, create a product with no attributes to use as your free product. You can put this in a hidden directory (see the hidden directory contribution.) I'll add this on to the wishlist as well.

 

The free product remaining in the cart is definitely a problem. I missed that one. This could be a bit tricky to fix. I'll put this bug first on the list to fix.

 

There's currently no way to specify multiple free products for a given purchase, it's just one free per n purchased. The multiplier is a limit -- it prevents the customer from getting more free products than you want to give, for those of us who want to only give one freebie per order. It can be more than one, but it's just a maximum limit. I'll add a multiple free products field to the wishlist.

 

I hope that's everybody. If not, let me know.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Great contrib! I have been looking for something like this. Besides leaving the item in the cart bug I noticed on the admin side that I can't set an item from active to inactive. When I click on the set inactive light, the page refreshes, but does not change the status.

 

One other thing is when it gives you the free item in the cart it does not add the weight of the item to the rest of the carts contents. Is there a way to keep the item free, but add the weight to the carts total? The way it is now, the estimated shipping quotes that come back from UPS or USPS can be way off depending on the weight of the item your giving for free.

 

Thanks again for the excellent contib :thumbsup:

Currently running 76 contibutions.

Link to comment
Share on other sites

Hi Jim!

thank you very very much for this nice and UNIC contrib!

I have installed it in a few minutes and work fine on this end!

I have a question: I have setting a free one for 4 buyed items. Is possible to buy 4 different items and to get the free items instead of 4 identic items?

I tried to set all products of a category as elegibles and, for all elegible items as set the same free one, but do not

does what i want... So, is not possible at all?

 

If you like to try go to my site www.romeomodels.com and add to the cart items on Napoleonics Category. The free is the first on list.

 

Thanks in advance for reply!

 

Enzo

Edited by essevi2001
Link to comment
Share on other sites

Yes, I am also looking for the feature to be able to buy multiple of any item and get one free. This could be limited to items in the same product category. My client, who needs this feature, only sells one type of product (but 5 styles of it) entered as different products. The customer should be able to choose any 2 different items and get one free.

 

Thanks for your consideration.

Link to comment
Share on other sites

I haven't been neglecting this topic (well, not deliberately) I've just been really busy. I have fixed most of the bugs that everyone has reported, including a few that I've found since. If things don't gt any crazier I'll have an update in the next day or so. Just a couple more things to take care of....

 

The current code does not allow multiples of different products to qualify. It must be a quantity of a single product to trigger the free product(s). This is partly a result of the peculiar system I used for securing the shopping cart against customers gaming the system to get unearned free products. This is turning out to be a bit of a headache, but I'm finally close to getting all of the bugs sorted. It may be possible to allow a qualifying quantity of any product that has been selected for this promotion, but it would take a fair amount of customization. The current system only looks at one product at a time, so it doesn't even see the other products.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I haven't been neglecting this topic (well, not deliberately) I've just been really busy. I have fixed most of the bugs that everyone has reported, including a few that I've found since. If things don't gt any crazier I'll have an update in the next day or so. Just a couple more things to take care of....

 

The current code does not allow multiples of different products to qualify. It must be a quantity of a single product to trigger the free product(s). This is partly a result of the peculiar system I used for securing the shopping cart against customers gaming the system to get unearned free products. This is turning out to be a bit of a headache, but I'm finally close to getting all of the bugs sorted. It may be possible to allow a qualifying quantity of any product that has been selected for this promotion, but it would take a fair amount of customization. The current system only looks at one product at a time, so it doesn't even see the other products.

 

Regards

Jim

 

Couple things... I just downloaded the zip file today...

 

1. In "catalog/includes/classes/shopping_cart.php", there is a hard coded date and time where it checks for expiration .... Should this be changed to >= date("Y-m-d H:i:s") ???

 

2. Since I do need "multiple product from a category to get X free", I would like to create a separate contribution (based on your code) that will detect multiple products under one category in a cart and add the specified free product to the cart. I've been working on it tonight and I almost have the admin side working properly. It will get a little tricky with parent-child categories, but it should not be too bad.... This could be integrated at a later time.

 

Chris

Link to comment
Share on other sites

Couple things... I just downloaded the zip file today...

 

1. In "catalog/includes/classes/shopping_cart.php", there is a hard coded date and time where it checks for expiration .... Should this be changed to >= date("Y-m-d H:i:s") ???

 

2. Since I do need "multiple product from a category to get X free", I would like to create a separate contribution (based on your code) that will detect multiple products under one category in a cart and add the specified free product to the cart. I've been working on it tonight and I almost have the admin side working properly. It will get a little tricky with parent-child categories, but it should not be too bad.... This could be integrated at a later time.

 

Chris

Rats. I was hoping that I could get rid of that test code before anybody noticed. Yes, that line should be

		if ($get_1_free['get_1_free_expires_date'] <= date('Y-m-d H:i:s')) {

I've moved that code into a new method, since it gets used in several places now, so you might want to look at the new version. Yes, I have fixes for most of the bugs, and some new (requested) features as well. I'll put this up as soon as I get instructions written. Real Soon Now.

 

You are of course welcome to modify this code to anything that you want. Please put your modifications up as a contribution when you are done. You could add it to this contribution as an option if you want.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

An updated version (1.1) has been added to the Contribution page. I recommend that everyone who is using Version 1.0 upgrade to the new one. The changes are:

 

Bug fixes:

* Fixed the active/inactive buttons on the admin page.

* Fixed an intermittent bug where the Calendar dropdown prevented the Expiry date from updating.

* Fixed the code to properly set the weight of free products and to count them in the total.

* Fixed a bug that converts a free product to full price if you remove the qualifying product. Mostly. This still seems to occur randomly. I'm working on isolating the cause so that I can fix the code.

* Replaced test code in the date handling function with the correct production code. Expiry dates should now be used properly.

* Fixed a bug that prevented free products from showing up in the Admin Orders pages.

 

New features:

* Added the ability to set the number of free products sent with a qualifying order.

* Added promotional text to the Products Info page (for qualifying products.)

 

The free product still can't have attributes. I intend to fix this someday, but it's a low priority right now since the workaround is so easy. Please post here if you find any more bugs, or if you have any more ideas for improvement.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hey all...

 

Anyone else having problems downloading version 1.1a of the Get One Free contrib??

 

I keep getting an error when I try to open the zip file.

Cheers

Tropolite

That was odd. The file is fine on my computer, but the uploaded file was broken. I've uploaded it again. Please let me know if you have problems with this one.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hello,

 

first, i want to say that´s a very nice contribution .. i test a little bit around and i think i found a little bug..

 

i add a get1free product on the admin site.. like buy 2 chairs and get 1 table for free.. so when i add 2 chairs to the shopping cart, the table added automatic.. thats ok .. but now when i press the update card button ( i changed nothing), the table are added again but now with full price, so it´s look like:

 

2 chairs (full price)

1 table (for free)

1 table (full price)

 

i hope you understand my bad english :)

 

Best regards

Marco

Link to comment
Share on other sites

Couple things... I just downloaded the zip file today...

 

1. In "catalog/includes/classes/shopping_cart.php", there is a hard coded date and time where it checks for expiration .... Should this be changed to >= date("Y-m-d H:i:s") ???

 

2. Since I do need "multiple product from a category to get X free", I would like to create a separate contribution (based on your code) that will detect multiple products under one category in a cart and add the specified free product to the cart. I've been working on it tonight and I almost have the admin side working properly. It will get a little tricky with parent-child categories, but it should not be too bad.... This could be integrated at a later time.

 

Chris

 

Chris, Your Multiple Product (from categories) buy to get one free (the cheapest) is exactly what i have been looking for, for a couple of months. Have you managed to get yours working ?

 

Since i am looking for the same thing if you need any help i would be happy to oblige

 

Stu

Link to comment
Share on other sites

Hello,

 

first, i want to say that´s a very nice contribution .. i test a little bit around and i think i found a little bug..

 

i add a get1free product on the admin site.. like buy 2 chairs and get 1 table for free.. so when i add 2 chairs to the shopping cart, the table added automatic.. thats ok .. but now when i press the update card button ( i changed nothing), the table are added again but now with full price, so it´s look like:

 

2 chairs (full price)

1 table (for free)

1 table (full price)

 

i hope you understand my bad english :)

 

Best regards

Marco

Yes, that's a bug. I've been looking for a solution but I don't have much time to work on this right now. It's definitely on the bug list though.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

First of all this was a really great contribution. Worked right away even with a heavily modified oscommerce shop :D

 

I tried to see if i could figure it out but i tought i would ask you Jim, i would like my customers to get one free product no matter what they buy.

 

Like the contribution is now you have to choose one and one product to set an free gift, is there someway i can choose all my products in a fast way?

 

Thanks again for this great contribution.

 

-Thomas-

Link to comment
Share on other sites

First of all this was a really great contribution. Worked right away even with a heavily modified oscommerce shop :D

 

I tried to see if i could figure it out but i tought i would ask you Jim, i would like my customers to get one free product no matter what they buy.

 

Like the contribution is now you have to choose one and one product to set an free gift, is there someway i can choose all my products in a fast way?

 

Thanks again for this great contribution.

 

-Thomas-

 

Was a bit fast there, i have this error in checkout_process.php

Fatal error: Call to a member function on a non-object in /home/vhosts2/v/o/localhost/www/checkout_process.php on line 282

 

The text i have in line 282 is:

if (is_array ($free_product = $this->get1free ($products_id))) {

 

Do you now what is wrong here?

 

If i take away that line i get everything to work but i makes a new line for each products the customer buys included the free product that say:

 

0 x 0% 0.00 NOK: 0.00 NOK: 0.00

 

Hope you can help me with this bug.

 

-Thomas-

Link to comment
Share on other sites

Was a bit fast there, i have this error in checkout_process.php

Fatal error: Call to a member function on a non-object in /home/vhosts2/v/o/localhost/www/checkout_process.php on line 282

 

The text i have in line 282 is:

if (is_array ($free_product = $this->get1free ($products_id))) {

 

Do you now what is wrong here?

 

If i take away that line i get everything to work but i makes a new line for each products the customer buys included the free product that say:

 

0 x 0% 0.00 NOK: 0.00 NOK: 0.00

 

Hope you can help me with this bug.

 

-Thomas-

Ouch. Yes that is a bug. Try replacing Line 282 with this:

	if (is_array ($free_product = $cart->get1free ($products_id))) {

I'm afraid there is no easy way to set all of your products for Get 1 Free. This contribution uses a separate database table to hold the promotions, so you can't do a simple SQL to add them all. I'm afraid you'll have to do it the hard way.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Ouch. Yes that is a bug. Try replacing Line 282 with this:
	if (is_array ($free_product = $cart->get1free ($products_id))) {

I'm afraid there is no easy way to set all of your products for Get 1 Free. This contribution uses a separate database table to hold the promotions, so you can't do a simple SQL to add them all. I'm afraid you'll have to do it the hard way.

 

Regards

Jim

 

I have figured out how i can set all the products with a free products, used sql :D

 

But i see now when i have fixed this and tried to buy some products, that for each products i insert in the basket the gift also get included. Sow if i buys 5 various proucts i also get 5 gifts.

 

How can i manage sow that i only get one gift no matter how many products i buys?

 

Hope you can help me with this.

 

Best Regards

Thomas

Link to comment
Share on other sites

Great contribution! Worked perfectly when I installed it. Now i'm trying to modify my promotion line in the products page and am having some trouble.

 

I am trying to get it to read "Special Offer: Buy (# of products), Get (# of products free)." it will always be the same product that they get free so I don't really need the name of the product in the line. Here's my code:

 

catalog/includes/english/product_info.php

define('TEXT_GET_1_FREE_PROMOTION', '<b><i><font color = ffffff>Special Offer:</b> Buy %u Get %u Free!</i></font>');

 

catalog/product_info.php

 if (tep_db_num_rows($get_1_free_query) > 0) {
  $free_product = tep_db_fetch_array($get_1_free_query);
  echo '<p>' . sprintf (TEXT_GET_1_FREE_PROMOTION, $free_product['products_qualify_quantity'], $product_info['products_name'], 

$free_product['products_free_quantity']) . '</p>';

 

I'm getting this output: "Special Offer: Buy 2 Get 0 Free!" even though my promotion is set to buy 2, get 1 free.

Any help would be great!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...