Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get 1 Free


kymation

Recommended Posts

The product_info.php does call TABLE_GET_1_FREE. That has to be properly defined, and the get_1_free table has to exist. Otherwise I don't know what you mean.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 5 weeks later...

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 '// added for Get 1 Free mod g1f.products_free_quantity, ' at line 2

 

select pd.products_name, pd.products_id, // added for Get 1 Free mod g1f.products_free_quantity, g1f.products_qualify_quantity from get_1_free g1f, products_description pd where g1f.products_id = '238' and pd.products_id = g1f. products_free_id and pd.language_id = '1' and status = '1'

im getting this error on my product pages

Link to comment
Share on other sites

create a new infobox in includes/boxes/get_1_free.php say now create a template for get_1_free.php you will also need to add this in the includes/modules/sts_inc/sts_column_left.php

in your new box paste the following code

<?php
/*
 $Id: get_1_free.php 1739 2007-12-20 00:52:16Z hpdl $

 Copyright (c) 2003 osCommerce, http://www.oscommerce.com

 Released under the GNU General Public License
*/
//random if more than one free product
$get_1_free_query = tep_db_query("select products_id 
								  from " . TABLE_GET_1_FREE . " order by rand() limit 0,12");

if (tep_db_num_rows($get_1_free_query) > 0) {
 $free_product = tep_db_fetch_array($get_1_free_query);

  $product_info_query = tep_db_query("select p.products_id, pd.products_name,  p.products_image, pd.products_url, p.products_price, p.products_tax_class_id  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$free_product['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product = tep_db_fetch_array($product_info_query);
?>
<!-- get_1_free //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => 'Get 1 Free');

new infoBoxHeading($info_box_contents, false, false);

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $product['products_image'], $product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($product['products_price'], tep_get_tax_rate($product['products_tax_class_id']));

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- get_1_free_eof //-->
<?php
 }
?>

I havent been able to test it but it should work ok

how would i go about making the box so it has a arrow like the reviews box where you click on it and it opens up a new page and it will show all get1 frees there

Link to comment
Share on other sites

Replace this line:

        new infoBoxHeading($info_box_contents, false, false);

with this:

        new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_GET_1_FREE));

Replace FILENAME_GET_1_FREE with whatever you defined your new filename to be, or just define that. Then create that page (similar to reviews.php) and collect the product IDs from the get_1_free database table.

 

Regards

Jim

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

Link to comment
Share on other sites

Probably, but not with this code. You might be able to modify it to do that if you want the "free" products to sell at a single fixed price.

 

Regards

Jim

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

Link to comment
Share on other sites

There's no such file in Version 1.3, which is the latest one I support. You're on your own with any of the "later" versions.

 

Regards

Jim

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

Link to comment
Share on other sites

There's no such file in Version 1.3, which is the latest one I support. You're on your own with any of the "later" versions.

 

Regards

Jim

 

Ok, thanks. I just downloaded 1.3 and I'm attempting to modify catalog/admin/includes/boxes/catalog.php but it looks like the structure is different than specified in the installation instructions. The install.txt says to look for this:

 

'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>';

 

But that is not found, I only have this:

 

array(
       'code' => FILENAME_PRODUCTS_EXPECTED,
       'title' => BOX_CATALOG_PRODUCTS_EXPECTED,
       'link' => tep_href_link(FILENAME_PRODUCTS_EXPECTED)
     )

 

Any suggestions? Could I simply skip this step?

Edited by ckpepper02
Link to comment
Share on other sites

  • 5 months later...
  • 6 months later...

Hi

 

I try to install but i get this error

 

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 '-12, 12' at line 20

 

select p.products_id, pd.products_name, p.products_price, g1f.get_1_free_id, g1f.products_free_id, g1f.products_free_quantity, g1f.products_qualify_quantity, g1f.products_multiple, g1f.get_1_free_date_added, g1f.get_1_free_last_modified, g1f.get_1_free_expires_date, g1f.date_status_change, g1f.status from products p, get_1_free g1f, products_description pd where p.products_id = pd.products_id and pd.language_id = '4' and p.products_id = g1f.products_id order by pd.products_name limit -12, 12

 

 

Can you help?

 

thanks

Link to comment
Share on other sites

That error is caused by running a very old copy of osCommerce on a newer version of PHP. Maybe if you post your osC version number and the page you're seeing this error on I can help.

 

Regards

Jim

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

Link to comment
Share on other sites

There is no osCommerce version 2.2. I don't have time to look them all up, but this was fixed in osCommerce 2.2RC2a and probably before. You need to update your code to fix this problem. I recommend doing the bugfixes as well as the security fixes. Note that it would probably be easier to just start over with a clean copy of 2.3.2 and make whatever changes you need.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 3 weeks later...

First, a BIG thanks for the contrib.

 

I have installed on 2.3, had to make a few tweeks but no problems at all... works like a dream... and excellent install instructions, thanks for making an effort!

 

However... I was wondering if you could help me with a slight alteration that I require.

 

I am using the QTPro contribution to allocate stock to my attributes... so say I have an Item of clothing in sizes - small, medium.. etc

All I would like to ask is if it would be possible to have the Get1Free contrib check against product title (which will be unique and minus its attribute ofcourse) to make its check for quallifing for the free product because i think the QTPro creates seperate product id's for each attribute to asign stock to it - I THINK!!! I could be wrong.

 

To give an example -

 

Curently I have set - buy 2 jumpers, get a matching phone cover free (for example):

 

when somebody buys 2 jumpers, but 1 in medium and 1 in large, there is no free product added.... only if you buy 2 jumpers both medium, for example, will it add the free phone cover.

 

I DONT actually need to allocate a particular product attribute as a free product, so hopefully that makes it a lot lot simpler... just need the qualifier check altering perhaps.

 

What I would like it to do is no matter whether the customer has selected 1 large and 1 small, it will still see that as 2 of that product and add the free product.. which is why I think prehaps doing the qualifier check against the product title.... would that be easy to alter?

 

Any help you could provide would be very very apreciated.

Thanks

Martin

Edited by Sumisu
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...