evaland Posted June 2, 2007 Share Posted June 2, 2007 Thanks your reply sir, I will happy wait you This problem has been mentioned before. I now think that a complete rewrite will be needed to cover all of the problems with this method. I don't have time to do this right now, but I will work on it as soon as I have time. Regards Jim Quote Link to comment Share on other sites More sharing options...
evaland Posted June 3, 2007 Share Posted June 3, 2007 I found a little bug in the install.txt in install.txt about modify the catalog/checkout_process.php. // start Get 1 free // If this product qualifies for free product(s) add the free products 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'], '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 missing the "$" it should be 'products_name' => $free_product['name'], Quote Link to comment Share on other sites More sharing options...
♥kymation Posted June 3, 2007 Author Share Posted June 3, 2007 Bother. I thought that I changed that everywhere. Obviously not. Thanks for the notice. I'll get it in the next version. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
patrickdk Posted June 7, 2007 Share Posted June 7, 2007 Hi Thanks for this great contribution. All my products are on attributte level. Is it possible to change the admin, so i can choose porducts on attribute level? Kind Regards Quote Link to comment Share on other sites More sharing options...
thedream Posted June 19, 2007 Share Posted June 19, 2007 Great contrib, thank you kymation ! I confirm there is a small bug in the shopping cart: When you do an update on the shopping cart page (shopping_cart.php) and modifying the quantity of the free product OR another one, the shopping cart set the product quantity (the one you have to pay) to 1, and the free product is deleted ! The trick is if the number of product you have to pay is under the number set in the admin part, and you set the amount required, the process is going well. But if you do another time setting 1 more, the free products desappear again! Any ideas to correct this? Quote osCommerce 2.2 MS2 in 6 languages TVA Intracomm Numbers of visitors online Who's online Enhancement .... Link to comment Share on other sites More sharing options...
thedream Posted June 19, 2007 Share Posted June 19, 2007 (edited) Great contrib, thank you kymation ! I confirm there is a small bug in the shopping cart: When you do an update on the shopping cart page (shopping_cart.php) and modifying the quantity of the free product OR another one, the shopping cart set the product quantity (the one you have to pay) to 1, and the free product is deleted ! The trick is if the number of product you have to pay is under the number set in the admin part, and you set the amount required, the process is going well. But if you do another time setting 1 more, the free products desappear again! Any ideas to correct this? ***UPDATE*** I have found something interesting !: This case appear only when the offer concern the same products, for example: if you get 2 chairs and you get the third one free, you will get the update bug ! insteed of if you get 2 chairs you get 1 table free, the update bug doesn't appear! Hope this help Kymation... Edited June 19, 2007 by thedream Quote osCommerce 2.2 MS2 in 6 languages TVA Intracomm Numbers of visitors online Who's online Enhancement .... Link to comment Share on other sites More sharing options...
fatbeatscom Posted June 26, 2007 Share Posted June 26, 2007 Free item does not add to the cart. Hello, I just added this contribution. Most of it seems to work fine. I made a modification for the listing in product_info.php to display another value of the free item, and placed it higher on the page, but besides that I have not made any modifications. Basically, any item I assign a free item works well as far as listing to the customers that they would get a free item. But, the free item does not get added to the cart, with the regular item. I cannot find, in the code, where the free item gets added to the cart at a 0.00 value. here is an example of a product with a free item assigned to it. http://www.fatbeats.com/catalog/product_in...roducts_id=4014 can anyone help me? Here is my modified code in product_info.php // start Get 1 Free // Display promotional text if this product qualifies for free product(s) $get_1_free_query = tep_db_query("select pd.products_name, m.manufacturers_name, p. products_id, g1f.products_free_quantity, g1f.products_qualify_quantity from " . TABLE_GET_1_FREE . " g1f, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where g1f.products_id = '" . (int)$product_info['products_id'] . "' and pd.products_id = p.products_id and m.manufacturers_id = p.manufacturers_id and pd.products_id = g1f. products_free_id and pd.language_id = '" . (int)$languages_id . "' and status = '1'" ); 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'], $free_product['manufacturers_name'], $free_product['products_name']) . '</p>'; } // end Get 1 Free Quote Link to comment Share on other sites More sharing options...
thepw Posted July 3, 2007 Share Posted July 3, 2007 Hi there, I have installed this contribution on a fresh install of OScommerce and whenever I add the main product and "free" product into the cart, the free product has the normal price assigned and this is carried into the checkout. Have I missed something? Paul Quote Link to comment Share on other sites More sharing options...
Arkadiy Posted July 25, 2007 Share Posted July 25, 2007 I've the same problem as indicated in post #49 Please help me resolve it. Quote Link to comment Share on other sites More sharing options...
offordscott Posted August 19, 2007 Share Posted August 19, 2007 I need to be able to add the "buy # of this product, get 1 free" message in the category view, and not the individual product view. Is there a quick way to add the message to each product row when viewing an entire category? Quote Link to comment Share on other sites More sharing options...
♥kymation Posted August 20, 2007 Author Share Posted August 20, 2007 I need to be able to add the "buy # of this product, get 1 free" message in the category view, and not the individual product view. Is there a quick way to add the message to each product row when viewing an entire category? This shouldn't be too hard. Take the new code from catalog/products_info.php and add it to the appropriate column in catalog/includes/product_listing.php. Add the code after the echo to the end of the $lc_text = string, and you'll probably need to change the $product_info['products_id'] to $listing['products_id'] I think that's all, but I haven't checked this, so it may be buggy. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
akshaynatu Posted September 19, 2007 Share Posted September 19, 2007 Hi Jim, This is a great contribution,thanx very much. I have the same problem with the free gift doing strange things in the shopping cart when you remove the qualifying product and the update problem mentioned by Marco. I have downloaded version 1.2a which also had something called "gift ideas" is that what i have to install to fix the bugs? because i really dont need any of the stuff mentioned in that contribution in my shopping cart. Cheers, Akshay. Quote Link to comment Share on other sites More sharing options...
elcidd Posted October 10, 2007 Share Posted October 10, 2007 (edited) This contribution allows you to promote a product by giving a free product whenthe 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. Hey, thanks for this terrific contribution. I've installed it on an OSC 2.2 rc1 shop but when I try to go to my shop (catalog side) I get the following error: Parse error: parse error, unexpected T_ECHO in /homepages/21/d202393536/htdocs/wii/Backup/includes/classes/shopping_cart.php on line 439 The code referenced is: echo tep_db_num_rows($get_1_free_query) ; This is the code in question in its context (snippet starts on line 427): // start Get 1 Free function get1free ($products_id) { global $languages_id; $get_1_free_query = tep_db_query("select products_free_id, products_free_quantity, products_qualify_quantity, products_multiple, get_1_free_expires_date from " . TABLE_GET_1_FREE . " where products_id = '" . (int)$products_id . "' and status = '1'" echo tep_db_num_rows($get_1_free_query) ; ); if (tep_db_num_rows($get_1_free_query) > 0) { $get_1_free = tep_db_fetch_array($get_1_free_query); //Check that the offer has not expired //MNK bugfix 13.08.2007 Any Ideas? Thanks Lionel Edited October 10, 2007 by elcidd Quote Link to comment Share on other sites More sharing options...
elcidd Posted October 10, 2007 Share Posted October 10, 2007 (edited) Hey, thanks for this terrific contribution. I've installed it on an OSC 2.2 rc1 shop but when I try to go to my shop (catalog side) I get the following error: Parse error: parse error, unexpected T_ECHO in /homepages/21/d202393536/htdocs/wii/Backup/includes/classes/shopping_cart.php on line 439 The code referenced is: echo tep_db_num_rows($get_1_free_query) ; This is the code in question in its context (snippet starts on line 427): // start Get 1 Free function get1free ($products_id) { global $languages_id; $get_1_free_query = tep_db_query("select products_free_id, products_free_quantity, products_qualify_quantity, products_multiple, get_1_free_expires_date from " . TABLE_GET_1_FREE . " where products_id = '" . (int)$products_id . "' and status = '1'" echo tep_db_num_rows($get_1_free_query) ; ); if (tep_db_num_rows($get_1_free_query) > 0) { $get_1_free = tep_db_fetch_array($get_1_free_query); //Check that the offer has not expired //MNK bugfix 13.08.2007 Any Ideas? Thanks Lionel OK, I hink I figured out that problem. Since I have a moderately modded shop I installed this contribution by merging the included .php files into mine. I just copied and pasted the code for this particular shopping_cart.php into this area and I resolved the issue with the error code but I get another one: Parse error: parse error, unexpected $ in /homepages/21/d202393536/htdocs/wii/Backup/ includes/classes/shopping_cart.php on line 492 I do not have anything in line 492. Here is a copy of the code (474 to 491 (end of file)): $products_free = tep_db_fetch_array($products_free_query); // Return an array of free product values $output = array ( 'id' => $get_1_free['products_free_id'], 'quantity' => $free_quantity, 'name' => $products_free['products_name'], 'model' => $products_free['products_model'], 'image' => $products_free['products_image'], 'weight' => $products_free['products_weight'] ); return $output; } //if ($products_quantity } //else }//if (tep_db_num_rows // offer was not valid (disabled or expired) return false; }//function // end Get 1 Free ?> Did I miss something? Edited October 10, 2007 by elcidd Quote Link to comment Share on other sites More sharing options...
♥kymation Posted October 10, 2007 Author Share Posted October 10, 2007 OK, I hink I figured out that problem. Since I have a moderately modded shop I installed this contribution by merging the included .php files into mine. I just copied and pasted the code for this particular shopping_cart.php into this area and I resolved the issue with the error code but I get another one: Parse error: parse error, unexpected $ in /homepages/21/d202393536/htdocs/wii/Backup/includes/classes/shopping_cart.php on line 492 I do not have anything in line 492. Here is a copy of the code (474 to 491 (end of file)): <snip> Yes, that's a nasty error. Translation "There's a fatal error somewhere in this file, but we're not going to tell you where." I would start by looking at all of the changes made for this contribution. Look for things like a missing } or other mismatch. There are just too many possibilities to narrow it down any further. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Roaddoctor Posted October 24, 2007 Share Posted October 24, 2007 Nice contribution - installed 1.2b and all seems well with one question It appears in an earlier post here that the free item weight is now added to the cart. After installing I am not getting the free items weight quoted... Where should I look to? any advise appreciated. Quote -Dave Link to comment Share on other sites More sharing options...
♥kymation Posted October 24, 2007 Author Share Posted October 24, 2007 Nice contribution - installed 1.2b and all seems well with one question It appears in an earlier post here that the free item weight is now added to the cart. After installing I am not getting the free items weight quoted... Where should I look to? any advise appreciated. If the item shows in the shopping cart, the total count and weight should be added as well. Check your changes to catalog/includes/classes/shopping_cart.php, lines 163-168 (for the count) and lines 261-266 (for the weight.) Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Roaddoctor Posted October 24, 2007 Share Posted October 24, 2007 If the item shows in the shopping cart, the total count and weight should be added as well. Check your changes to catalog/includes/classes/shopping_cart.php, lines 163-168 (for the count) and lines 261-266 (for the weight.) Regards Jim Thank you for the reply. Triple checked all the code and it is correct. Everythings working perfectly except for the weight and item count. My shopping_cart.php has a lot of other differences though so thats suspect. Also this a 2.2RC1 install. Have you tested this with the RC1 patches? I've had some other weird grief from RC1. FedEx Direct 2.07 is the shipping module I am using. If you have any suggestions or want me to post or email code please let me know... I'll keep digging Quote -Dave Link to comment Share on other sites More sharing options...
♥kymation Posted October 24, 2007 Author Share Posted October 24, 2007 I can't think of anything else right now. 2.2rc1 is a possible problem area, given that some of the function changes have caused me problems elsewhere. Try looking at the orders database tables -- is the data being stored? If not, check the data being shipped to checkout_process.php and work back from there. I have been working on a new version of this whole mess, but I keep getting interrupted by paying work. If I can ever manage to get it finished, it will definitely be tested with 2.2rc1. Just don't hold your breath. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Roaddoctor Posted October 25, 2007 Share Posted October 25, 2007 I do not know if this is helpful, but using: echo '<pre>'; print_r($_SESSION); echo '</pre>'; I placed a qualifying quantity of 4 items into the shopping cart, the free item appears with 0.00 as it should with this result: Array ( [cart] => shoppingcart Object ( [contents] => Array ( [28] => Array ( [qty] => 4 ) ) [total] => 11.5 [weight] => 2 [cartID] => 88949 [content_type] => physical ) [language] => english [languages_id] => 1 [currency] => USD [navigation] => navigationhistory Object ( [path] => Array ( [0] => Array ( => index.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) [1] => Array ( => index.php [mode] => NONSSL [get] => Array ( [cPath] => 21 ) [post] => Array ( ) ) [2] => Array ( => product_info.php [mode] => NONSSL [get] => Array ( [products_id] => 28 [action] => add_product ) [post] => Array ( [cart_quantity] => 4 [products_id] => 28 [x] => 38 [y] => 7 ) ) [3] => Array ( => shopping_cart.php [mode] => NONSSL [get] => Array ( ) [post] => Array ( ) ) ) [snapshot] => Array ( ) ) [country] => 223 [shipping] => [estzipcode] => 60015 [new_products_id_in_cart] => 28 ) Anything jump out at you? like I mentioned, everything works great except the free item weight and item count is not being added. Thank you for the help. Quote -Dave Link to comment Share on other sites More sharing options...
♥kymation Posted October 25, 2007 Author Share Posted October 25, 2007 That looks reasonable to me. I'd have to dig into the code a bit to see what's messing up. Unfortunately I don't have the time to do that right now. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
bussieblues Posted October 30, 2007 Share Posted October 30, 2007 Nice contributions, works well but..... We sell products that are printed with uploaded pictures. Say mugs. As soon as you order 4 mugs with the same picture, no problem, you get the free product. But 4 different mugs with 4 different pictures gives me a total of 4 mugs in the shopping basket but NO free product. So this contributions doesn't look at total in basket of the same product, right ???? Is it possible to change this???? hope to hear soon Walter Quote Link to comment Share on other sites More sharing options...
♥kymation Posted October 30, 2007 Author Share Posted October 30, 2007 Nice contributions, works well but..... We sell products that are printed with uploaded pictures. Say mugs. As soon as you order 4 mugs with the same picture, no problem, you get the free product. But 4 different mugs with 4 different pictures gives me a total of 4 mugs in the shopping basket but NO free product. So this contributions doesn't look at total in basket of the same product, right ???? Is it possible to change this???? hope to hear soon Walter If I understand you correctly, your four different mugs are four different products. This would be the expected behavior. This contribution is designed to give a free product for a given quantity of a single product, not the cart total number of products. I remember seeing a contribution that gives a free product for orders over a total cost, if that would help. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
bussieblues Posted October 30, 2007 Share Posted October 30, 2007 If I understand you correctly, your four different mugs are four different products. This would be the expected behavior. This contribution is designed to give a free product for a given quantity of a single product, not the cart total number of products. I remember seeing a contribution that gives a free product for orders over a total cost, if that would help. Regards Jim That would help a lot, I tried to find it but no luck, maybe you know where it is :blink: Quote Link to comment Share on other sites More sharing options...
♥kymation Posted October 30, 2007 Author Share Posted October 30, 2007 That would help a lot, I tried to find it but no luck, maybe you know where it is :blink: Sorry; I tried and couldn't find it either. Perhaps it was just a figment of my overworked memory. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.