Jump to content

Recommended Posts

I have a question about the promotional text on product_info.php. Is there an easy way to change the formatting/variables. Rather than display qty/product name and get qty/product name, I want only the Product name and get product name. As my shop is downloads only, quantity is irrelevant and due to the way the variables are being used (%u %s), I am having a heck of a time doing that.

 

I can always drop the text and put it in my product description, but automatic is always more effecient, and less chance of missing the get 1 free on a product because it is so convenient to just click on the product to see the generated text to it know it is working without having to add it to your cart. Heh.

Edited by desiredin

Share this post


Link to post
Share on other sites

That's easy enough. It's also covered in the instructions: See the use.txt file under Catalog Setup. If you still have questions, please be specific about what you want it to say and I'll help.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

Jim, I checked it out, and it isn't working the way I would expect it to.

 

define('TEXT_GET_1_FREE_PROMOTION', '<b>Special limited offer: Buy %u %s and get %u %s free!</b>');

Gives me: Special limited offer: Buy 1 There's Something About Mary and get 1 You've Got Mail free!

 

I figured that by leaving ou the %U I would get what I had wanted. Both titles, and no quantities.

define('TEXT_GET_1_FREE_PROMOTION', '<b>Special limited offer: Buy %s and get %s free!</b>');

Gives me: Special limited offer: Buy 1 and get There's Something About Mary free!

 

Just for the heck of it, I tried:

define('TEXT_GET_1_FREE_PROMOTION', '<b>Special limited offer: Buy %u and get %u free!</b>');

Gives me: Special limited offer: Buy 1 and get 0 free!

 

The origional text works the way it should, and as for the rest of it....my undestanding, is that I do not understand. ;)

Share this post


Link to post
Share on other sites
That's easy enough.

 

I got it figured out. Heh. I had to remove the qty variables from product_info.php. Once I seen a different example earlier in this forum, it all made sense. ;) Thanks again.

Share this post


Link to post
Share on other sites
First problem, not sure if problem but needs to be confirmed

 

When the main product is removed from the cart, the freebie remains. In all fairness it does put the correct price on it, but shouldn't it be linked to the main product and also removed? [Puts on client thinking cap]Can just see a few clients adding a main product to the cart, later remove it and then find out that when they confirmed their order and obviously didn't check their cart, that they got billed for extra items which they did not want...

 

I am having a similar issue on the latest version.

When you have 1 G1F enabled product:

Works great

 

When you have 1 G1F enabled product, and 1 regular product:

Works great

 

When you have 2 G1F enabled products, and the 2nd G1F product is removed from cart, it's free product is removed as well, BUT the free product of the first G1F is added to the cart again, with it's full price.

 

Is anyone else experiencing this problem?

Share this post


Link to post
Share on other sites

are there any future plans to include specific attributes for the product that will get free shipping

 

my case is i have a basic and full kit

 

i only off the free item with the full kit. however this contribution gives a free item either purchase

Share this post


Link to post
Share on other sites

Attributes are a pain to implement, so it's unlikely unless I get a lot of free time. Or somebody pays me to do it. Or somebody else does it. Feel free to code that in if you'd like to.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

GREAT CONTRIB, THANKS! Just what I needed. B)

 

I didn't read through this entire thread, but I found a bug in the Get 1 Free Mods.txt file:

 

Line 97: You must remove the commented-out section from the query, or you'll get a dB error.

 

Change:

pd.products_id, // added for Get 1 Free mod

To:

pd.products_id,

 

 

In addition, just a suggestion. In install.txt, in the catalog/product_info.php section, the code you provide that "can be placed elsewhere on the page" really should be as there were floating problems. Probably due to conflicts between the stylesheet and language files. I ended up putting it a new table row after the product name and price. That is, here, above the transparent separator row:

	  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
	  </tr>
<tr><td colspan="2" align="center"><div class="get1free">
<?php
// start Get 1 Free
  // If this product qualifies for free product(s) display promotional text
  $get_1_free_query = tep_db_query("select pd.products_name,
									pd.products_id,
									g1f.products_free_quantity,
									g1f.products_qualify_quantity
									from " . TABLE_GET_1_FREE . " g1f,
									" . TABLE_PRODUCTS_DESCRIPTION . " pd
									where g1f.products_id = '" . (int)$product_info['products_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 class=get1free>' . sprintf (TEXT_GET_1_FREE_PROMOTION, $free_product['products_qualify_quantity'], $product_info['products_name'], $free_product['products_free_quantity'], $free_product['products_id'], $free_product['products_name']) . '</p>';
  }
// end Get 1 Free
?>	
</div></td></tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?>

	</td>
  </tr>

Please note in the above I also edited the last echo statement from the Get 1 Free Mods.txt file to include the '<p class=get1free>' / '</p>' used in the install file.

 

Thanks again, and FWIW, it seems to be working just fine in v2.2 RC2a as well. (And GREAT documentation!)

Edited by jgeoff

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Share this post


Link to post
Share on other sites

PS - Here's a feature request. How about adding the opposite notification. Like, when you click on the "free" product it will say something like "Get this free with the purchase of X". That'd be cool. But you'd have to include a work-around if the item is available as a bonus from multiple other products, so something like, "Get this free with the purchase of one of these products: X, Y, Z."

 

Just a suggestion ;)


osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Share this post


Link to post
Share on other sites
PS - Here's a feature request. How about adding the opposite notification.

 

I have been thinking aout that myself. Viewing the code, I think it may be possible to

change the variable name of $get_1_free_query to something unique, reverse the order in which the query is made, and that should reverse the order the text is called. Alternatively, you could add another text variable and have something different altogether.

 

Took a quick stab at it, but not quite getting everything figured out. Heh. Just kind of stabbing in the dark.

Edited by desiredin

Share this post


Link to post
Share on other sites

Cool, Wayne, that'd be great.

 

Also...

 

Any simple way to add the "Buy This Get That Free" notification that's displayed on the product_info page to also be shown underneath the product's name on the category pages (index.php?cPath=X) ?

 

Thanks,

 

JG


osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Share this post


Link to post
Share on other sites

I just want to make sure

 

I installed this contribution today, I think it is great. The instructions (10th April 2008) were clear and easy to follow.

 

Everything seems to be working fine, but the install text said that there was a new file as follows :

 

catalog/admin/includes/functions/get_1_free.php

 

While I could find all the other files in the contribution I couldn’t find this one.

 

Am I going to have a problem ??

Share this post


Link to post
Share on other sites

Heh. Good eyes. I think that was a mistake in the package as mine is working fine, but I don't have that file either.

Share this post


Link to post
Share on other sites
Cool, Wayne, that'd be great.

 

Also...

 

Any simple way to add the "Buy This Get That Free" notification that's displayed on the product_info page to also be shown underneath the product's name on the category pages (index.php?cPath=X) ?

 

Yet another feature request, in addition to the above (and the "Get This Item Free With Purchase of X" request)...

 

I'd like to be able to add 2 or more free (distinct) items with the purchase of another item ("Buy X and get Y and Z Free!")

 

Wishful thinking? ;)

 

Thanks,

 

JG


osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Share this post


Link to post
Share on other sites
Any simple way to add the "Buy This Get That Free" notification that's displayed on the product_info page to also be shown underneath the product's name on the category pages (index.php?cPath=X) ?

 

I GOT IT!!! :) B)

 

I'm not a programmer so maybe this isn't the best or most efficient way to do this, but it's working!

Wayne, if you have any suggestions to tidy this up, please let me know.

 

ADDING "BUY X GET Y" TO THE PRODUCT LISTINGS:

 

In /catalog/includes/modules/product_listing.php replace the case 'PRODUCT_LIST_NAME': section with

				case 'PRODUCT_LIST_NAME':
		$lc_align = '';

				$get_1_free_query = tep_db_query("select pd.products_name,
									pd.products_id,
									g1f.products_free_quantity,
									g1f.products_qualify_quantity
									from " . TABLE_GET_1_FREE . " g1f,
									" . TABLE_PRODUCTS_DESCRIPTION . " pd
									where g1f.products_id = '" . (int)$listing['products_id'] . "'
									and pd.products_id = g1f. products_free_id
									and pd.language_id = '" . (int)$languages_id . "'
									and status = '1'"
									);


		if ((isset($HTTP_GET_VARS['manufacturers_id'])) && (tep_db_num_rows($get_1_free_query) > 0)) { 
		$free_product = tep_db_fetch_array($get_1_free_query);
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>' . '<p class=get1free2>' . sprintf (TEXT_GET_1_FREE_PROMOTION, $free_product['products_qualify_quantity'], $product_info['products_name'], $free_product['products_free_quantity'], $free_product['products_id'], $free_product['products_name']);
		} elseif (tep_db_num_rows($get_1_free_query) > 0) {
		$free_product = tep_db_fetch_array($get_1_free_query);
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ' . '<p class=get1free2>' . sprintf (TEXT_GET_1_FREE_PROMOTION, $free_product['products_qualify_quantity'], $product_info['products_name'], $free_product['products_free_quantity'], $free_product['products_id'], $free_product['products_name']);
		} elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> <br>';
		}
		break;		



/* ORIGINAL			
		case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a><br>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> <br>';
		}
		break;
*/

 

Add to /catalog/includes/languages/english/index.php

(This can be different than the wording in product_listing)

	// Get 1 Free
define('TEXT_GET_1_FREE_PROMOTION', 'Buy %u %s & Get %u <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=%s') .  '">%s</a> free!');

(The only problem I notice is that for some reason the first %s isn't displaying. It's coming out as "Buy 1 & Get 1 Y free!" for some reason -- any ideas?)

 

I also changed the stylesheet to include a separate class to display for index than the product_info page.

These are currently my personal settings:

.get1free { font-family: Verdana, Arial, sans-serif; font-size: 12px; background: #ffb3b5; border: 1px; border-color: #000000; }
.get1free2 { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #ff2222; }

 

 

 

Again, if it can be cleaned up (do we need the last two else's in there?) let me know.

 

JG

Edited by jgeoff

osC v2.2 RC2a w/ no special templates

PHP Version 5.2.14 / MySQL 5.0.91-community

Share this post


Link to post
Share on other sites

First of all thanks Jim for this great contribution. It's exactly what i nedeed!

 

But i think i found a bug. I'm not sure about this as i don't see anyone complaining about it.

 

When you want to offer 2 free products for every product they buy, my shopping cart keeps adding only one free product when it should add 2!

 

I should mention i use version 1.4.2.

 

After looking into the code, i saw that the quantity of free products is set by the $free_quantity variable of the get1free function in the catalog/includes/classes/shopping_cart.php file.

 

And to determine the quantity of free products you use this:

 

$free_quantity = floor ($products_quantity / $get_1_free['products_qualify_quantity']);

 

This is ok as long as the number of free products you want to give is 1. If you want to give 2 free products or more for each product they buy, you're function would look like this:

 

$free_quantity = floor (1 / 1);

 

It adds only one free product when it should add 2. If the customer buys 2 products ($free_quantity = floor (2 / 1)) it will add 2 when it should add 4 and so on.

 

My solution (i don't know if it's the best) is to multiply the $free_quantity with the number of free products. Like this:

 

$free_quantity = floor ($products_quantity / $get_1_free['products_qualify_quantity'] * $get_1_free['products_free_quantity']);

 

And i think that this was your logic too, otherwise i don't see the reason of creating a 'products_free_quantity' field in the table as long as you don't use it anywhere.

 

I already made this change on the site i am planning to launch in a few days, so please tell me if i am wrong.

 

Thanks again for the contribution,

Vassy

Share this post


Link to post
Share on other sites

That looks right to me. I messed up the math on that one. Good catch.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

I need to add a contrib that allows Spend £XX get X product free.

 

Would this one do that?

 

Thanks.


SolarFrenzy

Solar powered gadgets at down to earth prices.

 

CheekyNaughty

Promoting British Design

Share this post


Link to post
Share on other sites

Great Contribution! Thank you for sharing this with everyone.

 

Some Comments I'd like to Share:

 

I just installed this contribution a few days ago and everything seems to be working fine. My site has hundreds of products, 8 categories, and dozens of subcategories, so identifying the products being promoted is a must otherwise the "Get 1 Free" deal gets lost on the site.

 

I've only used this promotion on 1 category, so I will be making sure to announce this deals on the front page and also on the specific category page. Furthermore, I will need to make the products being promoted stand out from the rest of them in the product listing page. Since I'm not promoting that many products right now, I'll just make some changes in the product images and titles and that should do the trick. For the future, ideally, the promotion should stand out in the product listing page. That would be fairly easy to code, just add some image or text whenever a product is promoted using this contribution.

 

Has anybody already done this?

 

Maybe when I get some free time, I could put something together.

 

Peace,

 

Suhail

Share this post


Link to post
Share on other sites

Sorry, didn't want to be redundant, I just saw the post above from jgeoff offering a solution to what I posted above, I'll try to post a solution with a reduction in database queries

 

Suhail

Share this post


Link to post
Share on other sites

I'm having a couple of problems that really have me scratching my head. I'm no programmer by any means, but I can usually work through most of the problems I run in to, these have me stumped:

 

I'm running a fairly well modded cart w/ STS and several contributions www.shubee.com. After installing this contribution, the basic functionality works rather well, however:

 

1. I can't get any text to display anywhere regarding Get 1 Free. I've included the code in product_info.php, but nothing shows on my product pages - not even in the page source. I even tried to implement J Geoff's patch to include the text on all product pages but no luck.

 

2. When the user adds the necessary quantity to get 1 free, the cart successfully adds one free product (still no mention of getting one free though) seen here:

 

addtocart.gif -> addtocartfree.gif

 

however if they later updates their cart to have less than the minimum quantity to receive their free gift, the free item is removed and seems to be replaced with an item at regular price:

 

addtocartnofree.gif

 

Even stranger, if they later updated their cart again to include the free gift, the extra item that was added at regular price stays in the cart.

 

addtocartfreeagain.gif

 

I'd love to be able to use this contribution, but can't seem to wrap my head around where my problems are. Any help will be greatly appreciated!

Share this post


Link to post
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.

 

There is no Get 1 Free text on the Shopping Cart page. You could add that if you would like something there.

 

There is a fix for the free product not being deleted. Read back through this thread for the code. If the free product is not deleted, it becomes an ordinary product at the usual price. This is normal.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
This contribution allows you to promote a product by giving a free product when

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

 

 

I have a little issue with the Get 1 Free

 

I have the max set in the Admin, however if I have multiple products set to recieve the "Same Free Product" I end up with multiple free products in the cart. I.E.

 

1 Shampoo (qualifying product for conditioner) $5.00

1 Free Conditioner $0.00

 

1 Conditioner (qualifying product for conditioner) $5.00

1 Free Conditioner $0.00

 

1 Body Soap (qualifying product for conditioner) $5.00

1 Free Conditioner $0.00

 

 

I want the cart to just display the 1 Free Product I.E.

1 Shampoo (qualifying product for conditioner) $5.00

 

1 Conditioner (qualifying product for conditioner) $5.00

 

1 Body Soap (qualifying product for conditioner) $5.00

1 Free Conditioner $0.00

 

And if the qualifying products have different/unique Free Products to display apropriately. I.E.

1 Shampoo (qualifying product for conditioner) $5.00

 

1 Conditioner (qualifying product for conditioner) $5.00

 

1 Body Soap (qualifying product for wash cloth) $5.00

1 Free Conditioner $0.00

1 Free Wash Cloth $0.00

 

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

Share this post


Link to post
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.

 

There is no Get 1 Free text on the Shopping Cart page. You could add that if you would like something there.

 

There is a fix for the free product not being deleted. Read back through this thread for the code. If the free product is not deleted, it becomes an ordinary product at the usual price. This is normal.

 

Regards

Jim

 

Thanks for the quick reply. I'll look into it further this evening!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×