Jump to content



Photo
* * * * * 2 votes

Get 1 Free


  • Please log in to reply
380 replies to this topic

#21   bongo

bongo
  • Members
  • 147 posts
  • Real Name:Thomas Borge

Posted 07 April 2007 - 15:05

First of all this was a really great contribution. Worked right away even with a heavily modified oscommerce shop /biggrin.gif' class='bbc_emoticon' alt=':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-

#22   bongo

bongo
  • Members
  • 147 posts
  • Real Name:Thomas Borge

Posted 07 April 2007 - 15:18

First of all this was a really great contribution. Worked right away even with a heavily modified oscommerce shop /biggrin.gif' class='bbc_emoticon' alt=':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-

#23   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 8,401 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 07 April 2007 - 17:25

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

My Addons

Banners Box Download Support
Categories Accordion Box Download Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box Download Support
Get 1 Free 2.2x Support
Modular Front Page Download Support
Modular SEO Header Tags Download Support
MVS 2.2x Support
PDF Datasheet Download Support
Price in Cart Only/MAPP Download Support
Price Updater 2.2x
Products Specifications 2.3.x Development Version Support Bugs/Suggestions
Request a Review Download Support
Shopping List Download Support New!
Specials Image Overlay Download Support
Superfish Categories Box Download Support
Theme Switcher 2.3+ Support  Updated


#24   bongo

bongo
  • Members
  • 147 posts
  • Real Name:Thomas Borge

Posted 08 April 2007 - 12:53

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 /biggrin.gif' class='bbc_emoticon' alt=':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

#25   lishen

lishen
  • Members
  • 9 posts
  • Real Name:Li-Shen

Posted 13 April 2007 - 15:30

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!

#26   kymation

kymation

    Code Monkey

  • Community Sponsor
  • 8,401 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 15 April 2007 - 01:53

<snip>
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!

You have an extra variable in your sprintf. Try it this way:
echo '<p>' . sprintf (TEXT_GET_1_FREE_PROMOTION, $free_product['products_qualify_quantity'], $free_product['products_free_quantity']) . '</p>';

Regards
Jim

My Addons

Banners Box Download Support
Categories Accordion Box Download Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box Download Support
Get 1 Free 2.2x Support
Modular Front Page Download Support
Modular SEO Header Tags Download Support
MVS 2.2x Support
PDF Datasheet Download Support
Price in Cart Only/MAPP Download Support
Price Updater 2.2x
Products Specifications 2.3.x Development Version Support Bugs/Suggestions
Request a Review Download Support
Shopping List Download Support New!
Specials Image Overlay Download Support
Superfish Categories Box Download Support
Theme Switcher 2.3+ Support  Updated


#27   paq1200

paq1200
  • Members
  • 98 posts
  • Real Name:Mike
  • Gender:Male
  • Location:Texas

Posted 18 April 2007 - 15:37

I have figured out how i can set all the products with a free products, used sql /biggrin.gif' class='bbc_emoticon' alt=':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



I am trying to figure the same thing out as you. I am trying to get it so when a customer buys any 2 items they can choose an item priced lower than the lowest amount of the product they purchased. But I am trying to figure out how to get it to choose all the items in my database. We have over 2000 items.

Can you share with me how you did the sql to set all the products with a free products?

Thanks
Mike

#28   djbastard

djbastard
  • Members
  • 8 posts
  • Real Name:Jochem

Posted 24 April 2007 - 08:29

Hi

Great contribution so far but i stumbled upon an error /sad.gif' class='bbc_emoticon' alt=':(' />

in checkout_process.php i get: Parse error: syntax error, unexpected '[', expecting ')' in /.../..../public_html/dev/checkout_process.php on line 237

Line 222 until 246 - line 237 is bold

'products_name' => free_product['name'],
'products_price' => 0,
'final_price' => 0,
'products_tax' => '',
'products_quantity' => $free_product['quantity']
);
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$total_weight += ($free_product['quantity'] * $free_product['weight']);
}
// end Get 1 free
}
_linenums:0'>$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; // start Get 1 free // If this product qualifies for free product(s) add the free products// if (is_array ($free_product = $this->get1free ($products_id))) { if (is_array ($free_product = $cart->get1free ($products_id))) { // Update products_ordered (for bestsellers list) // Comment out the next line if you don't want free products in the bestseller list tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $free_product['quantity']) . " where products_id = '" . tep_get_prid($free_product['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => $free_product['id'], 'products_model' => $free_product['model'], <strong class='bbc'>'products_name' => free_product['name'],</strong> 'products_price' => 0, 'final_price' => 0, 'products_tax' => '', 'products_quantity' => $free_product['quantity'] ); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $total_weight += ($free_product['quantity'] * $free_product['weight']); }// end Get 1 free }


does anyone know a fix for this?

#29   candleman

candleman
  • Members
  • 65 posts
  • Real Name:JP
  • Gender:Male
  • Location:West Virginia, USA

Posted 24 April 2007 - 08:42

Try changing this
'products_name' => free_product['name'],
to this
'products_name' => $free_product['name'],

I'm no coder, but it looks like the $ is missing.
Currently running 76 contibutions.

#30   djbastard

djbastard
  • Members
  • 8 posts
  • Real Name:Jochem

Posted 24 April 2007 - 09:42

thnx m8,

Stupid that i haven't seen that myself /blink.gif' class='bbc_emoticon' alt=':blink:' /> (bangin head to the wall)

I made some changes and fixes to the package and released it under "Get 1 free 1.1b"

tested and it works like a charm.


Greetz

Edited by djbastard, 24 April 2007 - 09:45.


#31   2-b-fit

2-b-fit
  • Members
  • 7 posts
  • Real Name:Bent Bjoernskov

Posted 25 April 2007 - 15:43

"Get 1 free 1.1b" seems to be empty to me!?

Rgds.
Bent Bjørnskov

#32   candleman

candleman
  • Members
  • 65 posts
  • Real Name:JP
  • Gender:Male
  • Location:West Virginia, USA

Posted 25 April 2007 - 16:19

thnx m8,

Stupid that i haven't seen that myself /blink.gif' class='bbc_emoticon' alt=':blink:' /> (bangin head to the wall)

I made some changes and fixes to the package and released it under "Get 1 free 1.1b"

tested and it works like a charm.
Greetz


Thanks for the update and works like a charm for me also! /thumbsup.gif' class='bbc_emoticon' alt=':thumbsup:' />
Currently running 76 contibutions.

#33   candleman

candleman
  • Members
  • 65 posts
  • Real Name:JP
  • Gender:Male
  • Location:West Virginia, USA

Posted 25 April 2007 - 16:21

thnx m8,

Stupid that i haven't seen that myself /blink.gif' class='bbc_emoticon' alt=':blink:' /> (bangin head to the wall)

I made some changes and fixes to the package and released it under "Get 1 free 1.1b"

tested and it works like a charm.
Greetz


Thanks for the update and works like a charm for me also! /thumbsup.gif' class='bbc_emoticon' alt=':thumbsup:' />
Currently running 76 contibutions.

#34   madcrazygirl

madcrazygirl
  • Members
  • 521 posts
  • Real Name:c
  • Gender:Female
  • Location:United Kingdom

Posted 25 April 2007 - 16:39

This looks so great but was wondering can you use it to specify a free item with an order total over a certain figure? This would work even better for my purposes /thumbsup.gif' class='bbc_emoticon' alt=':thumbsup:' />

#35   fonkjam

fonkjam
  • Members
  • 29 posts
  • Real Name:Will

Posted 27 April 2007 - 10:15

Check to see if customer emails communications go through. Mine seemed to have stopped after this contribution.

#36   fonkjam

fonkjam
  • Members
  • 29 posts
  • Real Name:Will

Posted 27 April 2007 - 12:22

The Buy one Get one Free is what I need. I just need it to work. My Store is now live!

Problems I'm having with this contribution:

1. The Free item never shows up in my cart. The description indicating that you get it free shows, but never it transfers to the cart.
2. Confirmation Emails are not sent to customer after account setup,
3. Confirmation Emails are not sent to customer after completion of checkout -except by Paypal.
4. Emails sent to customer from the Admin Orders panel are not recieved by the customer.

I must have done something wrong because the emails worked prior to the modification.

There no error messages displayed at anypoint of these processes.

I really need a fix!

#37   fonkjam

fonkjam
  • Members
  • 29 posts
  • Real Name:Will

Posted 27 April 2007 - 12:25

The Buy one Get one Free is what I need. I just need it to work. My Store is now live!

Problems I'm having with this contribution:

1. The Free item never shows up in my cart. The description indicating that you get it free shows, but never it transfers to the cart. Q: should there be an image as well?
2. Confirmation Emails are not sent to customer after account setup,
3. Confirmation Emails are not sent to customer after completion of checkout -except by Paypal.
4. Emails sent to customer from the Admin Orders panel are not recieved by the customer.

I must have done something wrong because the emails worked prior to the modification.

There no error messages displayed at anypoint of these processes.

I really need a fix!

#38   fonkjam

fonkjam
  • Members
  • 29 posts
  • Real Name:Will

Posted 28 April 2007 - 05:13

Item 1 Fixed! /rolleyes.gif' class='bbc_emoticon' alt=':rolleyes:' /> I really needed to put an expiration date in that field. It won't link to cart if left blank.
/crying.gif' class='bbc_emoticon' alt=':'(' /> Still don't know why emails not working. going to revert back to previous Saved Backup & move from there.


#39   fonkjam

fonkjam
  • Members
  • 29 posts
  • Real Name:Will

Posted 01 May 2007 - 00:15

Items 2.3.4 all settled. /thumbsup.gif' class='bbc_emoticon' alt=':thumbsup:' />
I've seen lots of posts with similiar problems (E-Mail) and I tried many suggestions but to no avail. What worked and what I recommend as a start is to down load the Email_Test contribution from the contributions page(s). Follow the instructions supplied or read posts on how it works. Basically, the test will tell you if the Email problem is on the Oscommerce side or with your hosting company. In my case the problem was with my host. I contacted them and the next day my emails were working again. Just like that! They didn't explain what they did, but somehow and for some reason they blocked emails sent from my Oscommerce shop.

I lost a couple nights of sleep tweeking this topic's contribution and all prior contributions I added. This process was very frustrating not to mention time consuming as I my site was not 100%. However, I'm happy now.

If reading this saves someone else time that is even better for us all! I don't mean to take the focus off this contribution's topic which is working as designed in my store. Great Job! /biggrin.gif' class='bbc_emoticon' alt=':D' />

Checkout my Sneaker Collectors Collections Site: It Must Be The Shoes

Edited by fonkjam, 01 May 2007 - 00:16.


#40   dabbidu

dabbidu
  • Members
  • 3 posts
  • Real Name:Mueller

Posted 24 May 2007 - 18:15

Hi,

First I want to thank kymation for this very nice contrib. /thumbsup.gif' class='bbc_emoticon' alt=':thumbsup:' />
Maybe I have found a small bug when adding products over the cart.

Following Case:
Running a Special limited offer like: Buy 2 Product-Y and get 1 Product-Y for free!
and a Special limited offer: Buy 2 Product-Z and get 1 Product-Z for free!

1. I add 1 x Product-Y to cart over product_info.php
2. I add 1 x Product-Z to cart over product_info.php
3. All seems to be OK
4. Now changing quantity from Product-Y in cart to 2 pcs. to get the free Product-Y and pressing update
5. A free product-Y has been added automatically to the cart - all is correct
6. Now changing quantity from Product-Z in cart to 2 pcs. to get the other free Product-Z and pressing update
7. and now the bug happens
8. The free Product-Y has been automatically removed from cart and the quantity from Product-Y has been set back to 1 pcs.,
9. The free product-Z has been correctly added to the cart and the quantity of Product-Z has been set to 2 pcs..

Did anyone have the same problem or did anyone have a workaround for this problem.

Thanks for any help!