Adam46 Posted March 2, 2008 Share Posted March 2, 2008 Sorry Guys!!!! made a typo in the includes/function/get_1_free.php file Just upload the one from the corrected 1.4 version Quote Link to comment Share on other sites More sharing options...
Measha06 Posted March 6, 2008 Share Posted March 6, 2008 Jim Will this contribution work with separate pricing contribution. I have used separate pricing contribution to set up three buying groups, retail, drop shipping and wholesale. If I were to install this contribution I would want to make offers to only one group the retail group. Would this be possible? or perhaps different offers for different groups! Looking forward to your advice prior to installation. regards Liz Quote Liz A very appreciative member still attempting to climb the steep learning curve! Link to comment Share on other sites More sharing options...
♥kymation Posted March 6, 2008 Author Share Posted March 6, 2008 Jim Will this contribution work with separate pricing contribution. <snip> Liz Not without some modification. This contribution works directly with the shopping cart to invisibly add products. You would have to add code to detect the customer group and apply the free product to the correct group. There would be a fair bit of PHP coding involved. 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...
ezoscommercelv Posted March 7, 2008 Share Posted March 7, 2008 I need a contribution like this but by category "Get 1 Free per category" Thanks LA Quote Link to comment Share on other sites More sharing options...
vinod41 Posted March 13, 2008 Share Posted March 13, 2008 Hi, gr8 contribution... BUT in your install.txt ========== New Files: ========== The following code files are new with this package: catalog/admin/get_1_free.php catalog/admin/includes/languages/english/get_1_free.php catalog/admin/includes/functions/get_1_free.php catalog/includes/functions/get_1_free.php ========== i can't find this file / folder :blush: catalog/admin/includes/functions/get_1_free.php Quote Link to comment Share on other sites More sharing options...
♥kymation Posted March 14, 2008 Author Share Posted March 14, 2008 I don't think that function is needed on the admin side. You should only need catalog/includes/functions/get_1_free.php 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...
vinod41 Posted March 14, 2008 Share Posted March 14, 2008 (edited) ok thanks, i'm on mid way of installing it.. in install.txt thill here it is fine -- Now find the following code [starting around line 324]: see next step Now save that file and close it. Now find the following code [around line 346]: Where to find the Code Which File ?? :unsure: ----------------------------------------- Now find the following code [starting around line 324]: --------------------------------------------------------------------------------------- $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '')); --------------------------------------------------------------------------------------- and add the following just after it: --------------------------------------------------------------------------------------- // start 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' => '' ); } //if (is_array // end Get 1 free --------------------------------------------------------------------------------------- Now save that file and close it. Now find the following code [around line 346]: :unsure: --------------------------------------------------------------------------------------- $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' => '' --------------------------------------------------------------------------------------- and change the last line of that to: --------------------------------------------------------------------------------------- 'attributes' => '', 'free' => 1 --------------------------------------------------------------------------------------- Now find the following code [starting around line 430]: :unsure: --------------------------------------------------------------------------------------- function unserialize($broken) { for(reset($broken);$kv=each($broken);) { $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } --------------------------------------------------------------------------------------- and add the following just after it: --------------------------------------------------------------------------------------- // 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'" ); 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 if (($get_1_free['get_1_free_expires_date'] <= date('Y-m-d H:i:s')) && ($get_1_free['get_1_free_expires_date'] != '0000-00-00 00:00:00')) { //offer has expired, so update the database and return false tep_db_query("update " . TABLE_GET_1_FREE . " set status = '0', date_status_change = now() where products_id = '" . (int)$products_id . "'" ); return false; } else { // Offer is valid, so check if the quantity qualifies $products_quantity = $this->contents[$products_id]['qty']; if ($products_quantity >= $get_1_free['products_qualify_quantity']) { // Qualifies, so get the quantity of free products $free_quantity = 1; if ($get_1_free['products_multiple'] > 1) { $free_quantity = floor ($products_quantity / $get_1_free['products_qualify_quantity']); if ($free_quantity > $get_1_free['products_multiple']) { $free_quantity = $get_1_free['products_multiple']; } } // Get the info on the free product $products_free_query = tep_db_query("select pd.products_name, p.products_model, p.products_image, p.products_weight from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$get_1_free['products_free_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'" ); $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 --------------------------------------------------------------------------------------- Now save that file and close it. Now open catalog/includes/languages/english/product_info.php and find the following code [around line 20]: --------------------------------------------------------------------------------------- define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge'); --------------------------------------------------------------------------------------- and add this just after it: --------------------------------------------------------------------------------------- // Get 1 Free define('TEXT_GET_1_FREE_PROMOTION', '<b>Special limited offer: Buy %u %s and get %u %s free!</b>'); --------------------------------------------------------------------------------------- This text may be modified to suit your needs -- see the use.txt file for hints. Now save that file and close it. That's it for the modifications. You can now go read use.txt to learn how to set up a promotion. Edited March 14, 2008 by vinod41 Quote Link to comment Share on other sites More sharing options...
Adam46 Posted March 15, 2008 Share Posted March 15, 2008 ok thanks, i'm on mid way of installing it.. in install.txt thill here it is fine -- Now find the following code [starting around line 324]: see next step Now save that file and close it. Now find the following code [around line 346]: Where to find the Code Which File ?? :unsure: ----------------------------------------- Now find the following code [starting around line 324]: --------------------------------------------------------------------------------------- $products_array[] = array('id' => $products_id, You will find the code in catalog/includes/classes/shopping_cart.php Just ignore the save and close this file instruction Quote Link to comment Share on other sites More sharing options...
jdmrgtnj Posted March 21, 2008 Share Posted March 21, 2008 I've installed all components, but when I click on get 1 free in my admin panel I get this error: 1146 - Table 'd60476892.get_1_free' doesn't exist select count(*) as total from products p, get_1_free g1f, products_description pd where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = g1f.products_id [TEP STOP] I tried starting over and reinstalled,,but still get this,,any fixes? thanks James Quote Link to comment Share on other sites More sharing options...
jdmrgtnj Posted March 21, 2008 Share Posted March 21, 2008 nevermind,,,fixed it Quote Link to comment Share on other sites More sharing options...
seareid Posted March 26, 2008 Share Posted March 26, 2008 I'm very new to oscommerce and could use assistance in adding this module to my website. Is there anyone out there that could assist me in adding this code for hire? Quote Link to comment Share on other sites More sharing options...
Measha06 Posted March 30, 2008 Share Posted March 30, 2008 Not without some modification. This contribution works directly with the shopping cart to invisibly add products. You would have to add code to detect the customer group and apply the free product to the correct group. There would be a fair bit of PHP coding involved. Regards Jim Hi Jim You said it wont work with separate pricing if you want different offers for different groups but what about if you were prepared to accept same offer on all groups - would it work? regards Liz Quote Liz A very appreciative member still attempting to climb the steep learning curve! Link to comment Share on other sites More sharing options...
♥kymation Posted March 30, 2008 Author Share Posted March 30, 2008 Hi Jim You said it wont work with separate pricing if you want different offers for different groups but what about if you were prepared to accept same offer on all groups - would it work? regards Liz That should work. If the Separate Pricing mod changes some of the same files, you might need to figure out the interfering code. I haven't tried this, so I can't say for sure. 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...
Guest Posted April 2, 2008 Share Posted April 2, 2008 Will this contribution allow you to buy different products from the same category and get a free item as long as they buy the minimum number of items from the category? For instance if a customer buys 5 bags of smoothie mixes (no matter what flavor or type) from the same category, they get a free bag of coffee. Thanks, Greg http://www.charliebean.com Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 3, 2008 Author Share Posted April 3, 2008 No, this mod is designed to work by product, not by category. It wouldn't be easy to modify either, but it could be done. 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...
desiredin Posted April 10, 2008 Share Posted April 10, 2008 I love this contribution. Soooooo close to what I need. Heh. I am trying to get a single attribute for the free product, to be passed to the shopping cart. But I am having a little trouble. I am trying to find in the array (if I'm even sounding like I know what I'm talking about) where I can set it so the attributes are passed for any product I apply the "Get 1 Free" to. All of my products have Attribute download Option YES or as the database goes: Under the table orders_products_attributes products_options : Download product_options_values : Yes Is there an easy way to pass these two by default, on to the "shopping cart" when the free product is being added? I have been looking through the code to see where, but if something is not obvious to me, I'm not going to figure it out. Heh. A quick code tweak would be great from anyone who can help. Perhaps eventually an update to the contribution to switch this option off and on in the admin section for exclusively download shops? Quote Link to comment Share on other sites More sharing options...
desiredin Posted April 10, 2008 Share Posted April 10, 2008 $25 Paypal to anyone who can give me a quick fix to the code in the next few days. It isn't much, but I'm serious....... [/incentive]. Quote Link to comment Share on other sites More sharing options...
desiredin Posted April 11, 2008 Share Posted April 11, 2008 Been up this morning and looking through the checkout_process.php code some more. It appears as more details are needed to be passed for it to work. But I may be wrong, but with that it does make sense. In particular: 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']); Quote Link to comment Share on other sites More sharing options...
dmcross Posted April 11, 2008 Share Posted April 11, 2008 (edited) Hello, I've tried to install this on 2.2 RC2a but it broke the install. Now I'm new to OSC and may have made a mistake in the modifying the files. But before I try again are there any known issues with this most recent release. Regards, David. Edited April 11, 2008 by dmcross Quote Link to comment Share on other sites More sharing options...
desiredin Posted April 11, 2008 Share Posted April 11, 2008 Hello, I've tried to install this on 2.2 RC2a but it broke the install. Now I'm new to OSC and may have made a mistake in the modifying the files. But before I try again are there any known issues with this most recent release. Regards, David. I've installed it on RC2.2 RC2 (the latest) and it works beautifully and install couldn't have been any easier. Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 11, 2008 Author Share Posted April 11, 2008 Wayne: Sorry I haven't been able to reply sooner. I'm just swamped with work right now. As a quick fix, I think you could hard-code your attributes into the Shopping Cart class. In includes/classes/shopping_cart.php, in the get_products() method, the products_array[] has a line: 'attributes' => '', You will need to find the proper format for the attributes. Sorry I don't remember that right now, except that it is a multi-dimensional array. This is just a quick response; yo may need to make other changes as well. 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...
desiredin Posted April 11, 2008 Share Posted April 11, 2008 25 beans for you my good man. ;) I'll PM you. All I had to do was load this: (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), into the attributes for the Get 1 Free portion so it looks like: // start 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' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), 'free' => 1 ); } //if (is_array // end Get 1 free Not sure if it works because of the way the attributes are being handled, from qty limiting changes I made, but so far so good. Need to do more testing with it but if it's working now, I can't see it not working with more products and frebies. :D Quote Link to comment Share on other sites More sharing options...
♥kymation Posted April 12, 2008 Author Share Posted April 12, 2008 All I had to do was load this:(isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), <snipped> That will load the attributes for the purchased product, not the free product. This will work only in the special case where all products have exactly the same attributes. In the general case, you would need to create a free_products_to_attributes database table and use that to retrieve the attributes for your free product. You would also need to modify the admin to select the attributes and populate the new table for each free product. Which is why this wasn't done in the first place. That, and I ran out of time to add more features. As usual. 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...
desiredin Posted April 12, 2008 Share Posted April 12, 2008 That will load the attributes for the purchased product, not the free product. This will work only in the special case where all products have exactly the same attributes. That's exactly what I want, which I why I figured to give it a shot. Heh. Every product in my database will (all my test products do currently) have the attributes Download Yes, as everything will be downloadable. So I figured passing on the variables for the array above it for a regular checkout product, to use for the free product would work just as good as specifying the attribute for the free product. I beleive in recycling. Heh. I'll do more testing here to see how it works with multiple free product offers and such, but I think my issue is solved. Quote Link to comment Share on other sites More sharing options...
desiredin Posted April 12, 2008 Share Posted April 12, 2008 Works like a charm. All downloads working beautifully for about 10 test products I created, and played around with. The Affiliate contribution works as it should with it as well. Not sure where it was getting it's pricing from to tally up affiliate commisions, but it's obviously coming from the order total, and not from any product pricing. Didn't expect anything other than, but I have to check these things. Heh. Perhaps down the line, it might be posible to include an option for a cascade effect / "daisy-chain" for the free products. Figured for people with albums, of video chapters a seperate product could be created for each chapter, so when you load the first, gives the second product for free, which in turn gives the third product for free, etc so each chapter/song becomes a seperate downloadable file. As opposed to a single big file. Just a thought. Quote 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.