Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get 1 Free


kymation

Recommended Posts

I have a little issue with the Get 1 Free

<snipped>

 

Is it possible that I have left out a crutial piece of code during my integration, or????? lol I just need a little help here!

 

Thank you, Justin

What you are seeing is the expected behavior. What you want is not something that this Contribution is capable of doing.

 

Regards

Jim

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

Link to comment
Share on other sites

What you are seeing is the expected behavior. What you want is not something that this Contribution is capable of doing.

 

Regards

Jim

 

 

Ok! I just wanted to make sure. I will just have to restructure the freebies a bit! :-) Is there any future plans to update this Contribution with more added control? Lol

 

Thank you, Justin

Link to comment
Share on other sites

The free product information not displaying on the product information pages is likely due to a conflict with one of your other mods. You may have put the added code in an area of the page that is no longer displayed. Try moving the Get 1 Free code to another part of the page. You'll have to experiment with this a bit.

 

Well, I think I've figured out my problem here. Our site was built on STS (before I came on board...). It took me a while to find the correct files used to create the product pages, which are buried under /catalog/includes/modules/sts_inc/...

 

Has anyone else had success installing this contribution on an STS cart? This contribution is exactly what I'm looking for, any pointers on installing it would be greatly appreciated. Thanks!

 

Chris

Link to comment
Share on other sites

  • 3 weeks later...

love the contribution, but for some reason whenever i go back to edit a promotion, the free product is set to the very first item in my list instead of the item it should be set to.

Link to comment
Share on other sites

Nima: My store doesn't do that. Then again, I'm still running version 1.3, so maybe you should try the Admin file from that one. If that doesn't help, it's probably a conflict with some other Contribution or mod in the Admin area.

 

tin: The Contribution files are in the Catalog directory by default, so the file you want is includes/functions/get_1_free.php.

 

Regards

Jim

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

Link to comment
Share on other sites

Nima: My store doesn't do that. Then again, I'm still running version 1.3, so maybe you should try the Admin file from that one. If that doesn't help, it's probably a conflict with some other Contribution or mod in the Admin area.

 

tin: The Contribution files are in the Catalog directory by default, so the file you want is includes/functions/get_1_free.php.

 

Regards

Jim

 

hi Jim!

 

Thank you!Im sorry i posted the wrong question.The file i couldn't find is catalog/admin/includes/functions/get_1_free.php

 

Thank you!

 

tin

Link to comment
Share on other sites

hi Jim!

 

Thank you!Im sorry i posted the wrong question.The file i couldn't find is catalog/admin/includes/functions/get_1_free.php

 

Thank you!

 

tin

 

HI!

 

I also got this error running sql file

 

MySQL: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=1' at line 14

 

please help

Link to comment
Share on other sites

The file you posted doesn't exist. That's an error in the instructions. You can ignore that file.

 

The SQL error is likely due to having a different version of MySQL than the prototype. Try changing this line [Line 18] of get_1_free.sql

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

to this

);

 

Regards

Jim

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

Link to comment
Share on other sites

I followed the install.txt flawlessly with my OSCMax installation @ calimixtapes.com/mixtapes and now the website doesnt show up at all.

 

Do I need to reverse the damage and give up or is there a way to get it working, I have no idea where this error's coming from.

 

I uploaded the right files and hand modified the others just to be safe. Can anyone help? Why is my website completely blank without any error msgs?

Link to comment
Share on other sites

I followed the install.txt flawlessly with my OSCMax installation @ calimixtapes.com/mixtapes and now the website doesnt show up at all.

 

Do I need to reverse the damage and give up or is there a way to get it working, I have no idea where this error's coming from.

 

I uploaded the right files and hand modified the others just to be safe. Can anyone help? Why is my website completely blank without any error msgs?

The only possibility I can see is a bad update to the catalog/includes/application_top.php file, or possibly catalog/includes/classes/shopping)cart.php. Nothing else would affect the whole site. Since your site is already heavily modified, make sure you do all of the changes by hand, since the (included) modified files will be quite different.

 

Regards

Jim

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

Link to comment
Share on other sites

The only possibility I can see is a bad update to the catalog/includes/application_top.php file, or possibly catalog/includes/classes/shopping)cart.php. Nothing else would affect the whole site. Since your site is already heavily modified, make sure you do all of the changes by hand, since the (included) modified files will be quite different.

 

Regards

Jim

 

 

Thanks I'll give those files a look. Hope it works!

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

Please excuse my ignorance but i have struggled to understand what the latest version does: I want the following

 

1.) Buy 1 get 1 FREE (same product)

 

2.) Buy 2 get 1 FREE (same product - 3 for 2)

 

3.) buy 1 get 1 FREE (shopper can select from a list of products assigned to this so they buy a t shirt and get the chance to select a pair of socks or stockings as they may be male or female so a choice of a FREE product would be good)

 

4.) choose any 3 products and get the cheapest product FREE

 

Out of the above...

 

a.) what does this contribution provide? 1,2,3,4?

b.) could you build the others quickly and how much?

 

I want to run all of these offers on my new shop at once....

 

cheers,,

 

Scott

Edited by fruffrant
Link to comment
Share on other sites

This contribution does 1 and 2. 3 and 4 would require a bit of modification. If you don't want to do this yourself, you should be able to hire a programmer to do it for you.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

That's a lot of products. You could write a SQL statement to load all of the products into the get_1_free database table. The exact code would depend on what you wanted to offer for free, the quantities involved, etc.

 

Regards

Jim

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

Link to comment
Share on other sites

It's certainly possible, but not with this Contribution. I would search through the Contribution list; there's probably one in there that does 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

  • 4 weeks later...

Hi Jim,

 

I have just installed this contribution and so far it is just the thing I need ;)

 

Unfortunately I am having slight problems with my shopping cart (it is modded lol)

 

Whenever I try to either :

 

a) remove a product from the cart (using a dosubmission statement)

	  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => 'class="productListing-data" valign="top"',
										 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'], '0', 'onClick="DoSubmission();"'));

 

or

 

B) changing a products quantity in the cart using this code

	  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => 'class="productListing-data" valign="top"',
										 'text' => tep_draw_input_field('quantity[]', $products[$i]['quantity'], 'size="2"') . tep_draw_separator('pixel_trans.gif', '100%', '4') . tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . tep_draw_hidden_field('products_id[]', $products[$i]['id'] . tep_draw_hidden_field('free[]', $products[$i]['free'])));

 

This error results:

 

Warning: implode() [function.implode]: Invalid arguments passed in /home/******/public_html/includes/functions/general.php on line 1512

 

Warning: implode() [function.implode]: Invalid arguments passed in /home/******/public_html/includes/functions/general.php on line 1512

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

 

select p.products_id, find_in_set('0', products_hide_from_groups) as hide_or_not, find_in_set('0', categories_hide_from_groups) as in_hidden_category from products p left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where p.products_id in ()

 

[TEP STOP]

 

As a I said the store is seriously moddified and the shopping cart was working spot on until I amended the code for this contribution.

 

Your help and/or advice would be appreciated.

 

Thanks

 

Aran

Link to comment
Share on other sites

This is a bit tricky. Get 1 Free makes changes to /includes/classes/shopping_cart.php to handle the free product(s). Apparently some of your other changes have also modified this class, and some of those modifications change the input to one of the functions in /includes/functions/general.php. You'll need to modify the Get 1 Free code in the same way the stock code is modified. You can probably find it by looking up the function that is being called and seeing how that is handled in the class.

 

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,

 

The function that is returning the error is this function and in particular this line

 

$list_of_products_ids = implode(',', $int_products_id_array);

 

Some how this is interferring with the way that the Get 1 Free code works.

 

function tep_get_hide_status($hide_status_products, $customer_group_id, $temp_post_get_array) {
	foreach ($temp_post_get_array as $key => $value) {
	$int_products_id = tep_get_prid($value);
 // the November 13 updated MS2.2 function tep_get_prid 
 // can return false with an invalid products_id 
		 if ($int_products_id != false ) {
			$int_products_id_array[] = $int_products_id;
	   }

	  $list_of_products_ids = implode(',', $int_products_id_array);

 } // end foreach ($temp_post_get_array as $key => $value)

   $hide_query = tep_db_query("select p.products_id, find_in_set('".$customer_group_id."', products_hide_from_groups) as hide_or_not, find_in_set('".$customer_group_id."', categories_hide_from_groups) as in_hidden_category from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id in (" . $list_of_products_ids . ")");
	// since a product can be in more than one category (linked products) we have to check for the
	// possibility of more than one row returned for each products_id where "hide_or_not"
	// is the same for every row, but "in_hidden_category" can be different
	unset($int_products_id_array); // start over
		$int_products_id_array = array();
		if (tep_not_null($hide_status_products)) {
		  foreach($hide_status_products as $key => $subarray) {
	$int_products_id_array[] = $hide_status_products['products_id'];
			}
		} // end if (tep_not_null($hide_status_products))
	while ($hide_products_array = tep_db_fetch_array($hide_query)) {
			$cat_hidden = '1';
			$prod_hidden = '0';
				if ($hide_products_array['hide_or_not'] != '0') {
					$prod_hidden = '1';
				} elseif ($hide_products_array['in_hidden_category'] == '0') {
					$cat_hidden = '0';
				}
				if ($prod_hidden == '0' && $cat_hidden == '0') { 
					$hidden = '0'; 
				} else {
					$hidden = '1';
				}
			  if (in_array($hide_products_array['products_id'], $int_products_id_array)) {
		  foreach($hide_status_products as $key => $subarray) {
			if ($subarray['products_id'] == $hide_products_array['products_id']) {
								if ($subarray['hidden'] == '1' && $subarray['prod_hidden'] == '0' && $cat_hidden == '0') {
									// product is not a hidden one and now found to be in a category that is not hidden
			  $hide_status_products[$key]['hidden'] = '0';
								}
			} // end if ($subarray['products_id'] == $hide_products_array['products_id'])
		   } // end foreach ($hide_status_products as $key => $subarray)
				  } else { 
					$hide_status_products[] = array('products_id' => $hide_products_array['products_id'], 'hidden' => $hidden, 'prod_hidden' => $prod_hidden);
				  }
	$int_products_id_array[] = $hide_products_array['products_id'];
	} // end while
		return $hide_status_products;
 }
// EOF SPPC, hide products and categories from groups

 

The code in the shopping_cart.php class file is just additions and not changes (correct me if I am wrong here) so I am not sure how to progress from here.

 

Thanks for your time

 

Aran

Edited by alwaysontop
Link to comment
Share on other sites

The code that Get 1 Free adds to the shopping cart class uses standard osCommerce functions to add a product, in much the same way that standard osCommerce adds a product. One or more of your previous modifications has changed the way osCommerce adds products, so the standard method that Get 1 Free is trying to use no longer works. You'll have to figure out what those changes are and apply them to the Get 1 Free additions. I can't give you any more explicit advice than that, since I'm not familiar with the other changes you've made.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

This is a terriffic contribution and with the original files and some help from the other posters I have ithis installed and working well.

 

However I am concerned with the update button issue when the product is in the cart where another product= the free product (but at the full price) is added just by clicking the update buton.

 

Is there any update on the resolution to this?

 

Also when I have 2 products which each offer the same additional product for free, 2 x free items are added to the cart!

So 1 for each product added.

 

We have a download store so its not much use to add 2 downloads of the same product.

Is there a way to make sure that the free product is added just once?

 

 

Apart from that it seems to work perfectly.

 

Thanks

 

Matt

Link to comment
Share on other sites

I haven't seen the condition where a product is added just by clicking the update button and nothing else. What version of osCommerce are you using? I don't have a test setup for this contribution right now; I'll try to load something up later today and test this out.

 

The addition of two free products when there are two qualifying products is normal. There's no way to prevent this without some serious mods to the code, since the two qualifying products are independent.

 

Regards

Jim

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

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...