Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get 1 Free


kymation

Recommended Posts

i receive an error in phpmyadmin

 

#1064 - syntax error near 'ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ' at line 14

 

any idea?

Different version of MySQL or phpMyAdmin? I tested this using a couple different versions, but you may have something else, or some setting is different. Try running it without the part in quotes in the error message. Those should be default settings anyway.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi there.

 

I have noted a bug with the quantity.

The setup is by 2 packs and get 1 free. Ok.

If my clients take 3, he get 1 free, normal (2+1 products = 1+0 free)

But if he takes 4 packs of the same products, he didn't get the multiple of the free product, tht's normally 2 free products.

 

Do you have an idea to correct this?

 

Best regards, :thumbsup:

osCommerce 2.2 MS2 in 6 languages

TVA Intracomm

Numbers of visitors online

Who's online Enhancement

....

Link to comment
Share on other sites

Hi there.

 

I have noted a bug with the quantity.

The setup is by 2 packs and get 1 free. Ok.

If my clients take 3, he get 1 free, normal (2+1 products = 1+0 free)

But if he takes 4 packs of the same products, he didn't get the multiple of the free product, tht's normally 2 free products.

 

Do you have an idea to correct this?

 

Best regards, :thumbsup:

 

This module is not designed to give more than 1 free... you would have to code it

-Dave

Link to comment
Share on other sites

Hi there.

 

I have noted a bug with the quantity.

The setup is by 2 packs and get 1 free. Ok.

If my clients take 3, he get 1 free, normal (2+1 products = 1+0 free)

But if he takes 4 packs of the same products, he didn't get the multiple of the free product, tht's normally 2 free products.

 

Do you have an idea to correct this?

 

Best regards, :thumbsup:

What do you have Maximum Free Products set to? This would be the expected behavior if it is set to 1. See the use.txt file in the distribution for more information.

 

Regards

Jim

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

Link to comment
Share on other sites

Thanks for replying. I set always 100 on the maximum free products, even if I have 35 products on stock.

Any ideas?

osCommerce 2.2 MS2 in 6 languages

TVA Intracomm

Numbers of visitors online

Who's online Enhancement

....

Link to comment
Share on other sites

What do you have Maximum Free Products set to? This would be the expected behavior if it is set to 1. See the use.txt file in the distribution for more information.

 

Regards

Jim

oops sorry Jim, i answered too quick without looking

-Dave

Link to comment
Share on other sites

Different version of MySQL or phpMyAdmin? I tested this using a couple different versions, but you may have something else, or some setting is different. Try running it without the part in quotes in the error message. Those should be default settings anyway.

 

Regards

Jim

 

no way i can pass that error :(

 

phpmyadmin 2.6.1

mysql 3.23

Link to comment
Share on other sites

no way i can pass that error :(

 

phpmyadmin 2.6.1

mysql 3.23

I didn't test with anything older than 4.2.x, so that could be the problem. Try creating the table with phpMyAdmin using the SQL in the distribution for the column specs. That should work for any version.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi Jim.

 

My purpose is just to answer to my clients who don't understand why the don't have the ratio of the free product ordered, as the logical: for example I order 2 I get 1 free, I order 4, I get 2 free, etc. There is a ratio thing. For the moment if they order 2, 3, 4 or more they get only 1. They don't understand.

So I am trying to respect your code as "buy x get y free", but if you order 3 x, you wil get 3 more free products...

I have made the following changes:

$output = array ( 'id' => $get_1_free['products_free_id'],
						  //'quantity' => $free_quantity,
						  'quantity' => floor($products_quantity*($get_1_free['products_free_quantity']/$get_1_free['products_qualify_quantity'])),
						  'name' => $products_free['products_name'],
						  'model' => $products_free['products_model'],
						  'image' => $products_free['products_image'],
						  //'weight' => $products_free['products_weight']
						  'weight' => $products_free['products_weight']*floor($products_quantity*($get_1_free['products_free_quantity']/$get_1_free['products_qualify_quantity']))
						);

It's working, except for one thing. when you do an update of the quantity on the products qualified for the free product, a new free product with its normal price is added to the cart, and I don't know how to correct this.

This code take the entire part of the ration with the setup made in the Get 1 free admin. With the ability to have:

buy 1 get 0 free,

buy 2 get 1 free (the ratio),

buy 3 get 1 free,

buy 4 get 2 free (a multiple of the ratio [qty*(qty free/Qty qualified)],

etc...

 

Am I wrong or not? We just have to find how to correct the resulting bug.

osCommerce 2.2 MS2 in 6 languages

TVA Intracomm

Numbers of visitors online

Who's online Enhancement

....

Link to comment
Share on other sites

I don't see the reason for this change. The original version works fine on several different stores. Please go to Admin > Catalog > Get 1 Free, click the Edit button for your product, then copy all of the settings into a post here.

 

The update bug is well known. Unfortunately I don't have a fix that doesn't involve rewriting most of this contribution. My regular work has been keeping me too busy to do more than plan out this major revision.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi Jim,

Can you clarify the feature set on your mod for me?

 

I have a client who sells greeting cards, and his goal is Buy any 5 cards get 1 free. Can it work for buy X number of any of the selected products? or is it only buy x # of this item get 1 free.

 

Furthermore is it possible to give the customer a choice of the free product?

 

Thanks! :thumbsup:

Link to comment
Share on other sites

Hi Jim,

Can you clarify the feature set on your mod for me?

 

I have a client who sells greeting cards, and his goal is Buy any 5 cards get 1 free. Can it work for buy X number of any of the selected products? or is it only buy x # of this item get 1 free.

 

Furthermore is it possible to give the customer a choice of the free product?

 

Thanks! :thumbsup:

Sorry, but no to both questions. There is at least one contribution that allows you to select a free product if the cart total is over a certain amount, but none that I know of based on quantity. Perhaps the one I linked to could be modified to do what 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

Here is the page for a product.

 

Product:   	Anneau
Quantity to Qualify:	  2
Maximum Free Products:	  100
Free Product:	  Anneau 2
Free Product Quantity:	  1
Expiry Date:	  Calendar

 

The dream

osCommerce 2.2 MS2 in 6 languages

TVA Intracomm

Numbers of visitors online

Who's online Enhancement

....

Link to comment
Share on other sites

Here is the page for a product.

 

Product:   	Anneau
Quantity to Qualify:	  2
Maximum Free Products:	  100
Free Product:	  Anneau 2
Free Product Quantity:	  1
Expiry Date:	  Calendar

 

The dream

That should work without any modification. Oh well, if it does what you want, then make the changes that you posted.

 

Regards

Jim

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

Link to comment
Share on other sites

Hello Jim,

 

can you tell me please which version to install?

 

Actually i dont know what version will work in the way it should so maybe a hint of the inventor woul be nice for me to find out.

 

Thank you very much.

Michael

1.2a is the best currently available. There is a known bug (which is discussed above) but most people consider it usable as is. It's up to you whether it is acceptable to you. The bug is not likely to get fixed until I have time for a complete rewrite.

 

Regards

Jim

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

Link to comment
Share on other sites

1.2a is the best currently available. There is a known bug (which is discussed above) but most people consider it usable as is. It's up to you whether it is acceptable to you. The bug is not likely to get fixed until I have time for a complete rewrite.

 

Regards

Jim

 

Hello!

 

Regarding this bug, I've notes it that when the free products's products_status = 0 then it works well. It doesn't exists a 'quick fix' for this problem, only the whole rewriting? I assume that when updating the shopping cart, there is a check for products_status. At that point could be a check as well if it's a free product (let's say that put an extra info to the shopping cart product, to know that it's about a free product).

 

Thx.

Link to comment
Share on other sites

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

 

 

Hi there!

 

Here's a quick fix for the "added again the free product but with full price" problem:

 

There are small modification in 3 files, highlited in red.

 

 

classes/shopping_cart.php, function get_products()

 

 

// Get 1 free

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

// Add the free product to the shopping cart (Customer cannot alter this)

$products_array[] = array('id' => $free_product['id'],

'name' => $free_product['name'],

'model' => $free_product['model'],

'image' => $free_product['image'],

'price' => 0,

'quantity' => $free_product['quantity'],

'weight' => $free_product['weight'],

'final_price' => 0,

'tax_class_id' => $products['products_tax_class_id'],

'attributes' => '',

'free' => 1

);

} //if (is_array

// end Get 1 free

 

 

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

shopping_cart.php

 

$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',

'text' => $products_name);

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . tep_draw_hidden_field('free[]', $products[$i]['free']) );

 

$info_box_contents[$cur_row][] = array('align' => 'right',

'params' => 'class="productListing-data" valign="top"',

'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');

}

 

new productListingBox($info_box_contents);

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

 

 

application_top.php, case 'update_product' section:

 

$isFree = $HTTP_POST_VARS['free'][$i];

if ($isFree != 1)

{

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

}

 

 

That's it, it works for me.

Link to comment
Share on other sites

Hi there!

 

Here's a quick fix for the "added again the free product but with full price" problem:

<code snipped>

That's it, it works for me.

Thanks for the patch. That does the job nicely. I was thinking of something much more complicated. Typical; I tend to over-design things.

 

Now I just need to package up all of the fixes everyone has contributed and put out a new release. If anyone knows of more bugs, now would be a great time to speak up.

 

Regards

Jim

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

Link to comment
Share on other sites

hello

 

why do i get this error on product_info : Warning: sprintf() [function.sprintf]: Too few arguments

 

would appreciate the help

The stock version has the correct arguments. Did you make some changes?

 

Regards

Jim

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

Link to comment
Share on other sites

And the new version is up. It's just a rollup of all the patches since 1.2, so those who have been keeping up here can safely ignore it. If you haven't already patched your copy, or if you're having problems, you might want to go get this new version.

 

As always, please post here if you find any bugs or if you have problems installing this.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi there,

 

I like the idea of your Add-On. However, when I tried to manually install the add-on it went wrong and did not work, so I reverted to a previously saved version of my site. However, when I reverted the changed files, I get the following error message where the application_bottom.php file should be displayed...any suggestions from anyone would be much appreciated.

 

 

 

1146 - Table 'toptoners.TABLE_COUNTER' doesn't exist

 

select startdate, counter from TABLE_COUNTER

 

[TEP STOP]

 

 

 

Thank you.

 

Mark

Edited by Jan Zonjee
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...