Jump to content
boxtel

2gether Discount

Recommended Posts

that didn't work :-(

 

the display module starts with:

 

<tr><td>

 

and ends with:

 

</td></tr>

 

so make sure that where you include the module you do it like :

<tr>

some other stuff you have....

</tr>

 

include the module

 

<tr>

some other stuff you have....

</tr>

 

 

so after a </tr> or <table> tag


Treasurer MFC

Share this post


Link to post
Share on other sites

what's left is how to change the font-size of the prices below the product images and below the buytogether text

Share this post


Link to post
Share on other sites
what's left is how to change the font-size of the prices below the product images and below the buytogether text

 

the original prices are displayed with:

 

if ($show_original_prices) echo $currencies->format($product_a_price);

if ($show_original_prices) echo $currencies->format($product_b_price);

 

you can alter that at will like:

 

if ($show_original_prices) echo '<span class="smalltext">'.$currencies->format($product_b_price).'</span>';

 

or use any class or <font> tag you wish.

 

the price under the together text is defined by :

 

$together_string = $currencies->format($together_price);

 

use the same principle for that.


Treasurer MFC

Share this post


Link to post
Share on other sites

Hi,

 

Almost ot this superb contirbution installed and working 100%, but i am getting somem strange calculation errors in the 2gether module output, the prices seem to be coming out slightly wrong (maybe they are being rounded up/down?), here is an example:

 

Bundle Price just:

?14.23 (inc.)

?12.11 (ex.)

and save 10%

 

You save ?1.59 (inc.) ?1.35 (ex.) 10%

Normal Combined Price ?15.80 (inc.) ?13.45 (ex.)

 

 

As you can see the normal price is ?15.80 so the 10% should be a saving of ?1.58 , but it shows the saving amount as ?1.59 - also the 'bundle' price is shown as ?14.23 which would indicate a saving of ?1.57 ! - so i am getting three different prices :/

 

the actual saving given at checkout is ok, i had to modify this slightly as it was always making the calculation excluding tax - i changed this to always include the tax. but the amount discounted at checkout is as it should be (?1.58).

 

If it is a tax rounding issue is it possible to remove tax from the module altogether, i can then manually add the tax and only show the 2gether module to customers within my tax area?

 

Thanks again!

 

 

Matt

Share this post


Link to post
Share on other sites
Hi,

 

Almost ot this superb contirbution installed and working 100%, but i am getting somem strange calculation errors in the 2gether module output, the prices seem to be coming out slightly wrong (maybe they are being rounded up/down?), here is an example:

 

Bundle Price just:

?14.23 (inc.)

?12.11 (ex.)

and save 10%

 

You save ?1.59 (inc.) ?1.35 (ex.) 10%

Normal Combined Price ?15.80 (inc.) ?13.45 (ex.)

As you can see the normal price is ?15.80 so the 10% should be a saving of ?1.58 , but it shows the saving amount as ?1.59 - also the 'bundle' price is shown as ?14.23 which would indicate a saving of ?1.57 ! - so i am getting three different prices :/

 

the actual saving given at checkout is ok, i had to modify this slightly as it was always making the calculation excluding tax - i changed this to always include the tax. but the amount discounted at checkout is as it should be (?1.58).

 

If it is a tax rounding issue is it possible to remove tax from the module altogether, i can then manually add the tax and only show the 2gether module to customers within my tax area?

 

Thanks again!

Matt

 

well, looks like a rounding issue, the original version is without tax calculations. Taxes were added after complains that it didn't do taxes.


Treasurer MFC

Share this post


Link to post
Share on other sites

First I must send props to a great contrib! Everything is working fantastically!

 

I have noticed an interesting 'bug'. The total submitted to Paypal after the 2gether discount isn't what it should be:

 

Store (converted) order Total: 255.02 (USD) <- this is the 2gether discounted order total

PayPal MC Total: 260.02 (USD)

 

It seems that the value sent to paypal is not taking the 2gether discount into account. I may be missing something (it's happened before) but I think I've looked everywhere.

The sort order in admin -> modules -> order total is:

 

Low Order Fee ---

Shipping 3

Sub-Total 1

Tax ----

2gether Discount 2

Total 99

 

Any ideas about this one?

 

Thanks,

Zoe

Share this post


Link to post
Share on other sites
First I must send props to a great contrib! Everything is working fantastically!

 

I have noticed an interesting 'bug'. The total submitted to Paypal after the 2gether discount isn't what it should be:

 

Store (converted) order Total: 255.02 (USD) <- this is the 2gether discounted order total

PayPal MC Total: 260.02 (USD)

 

It seems that the value sent to paypal is not taking the 2gether discount into account. I may be missing something (it's happened before) but I think I've looked everywhere.

The sort order in admin -> modules -> order total is:

 

Low Order Fee ---

Shipping 3

Sub-Total 1

Tax ----

2gether Discount 2

Total 99

 

Any ideas about this one?

 

Thanks,

Zoe

 

well, I have no paypal so the first thing is for you to determine where your paypal module gets its total from.


Treasurer MFC

Share this post


Link to post
Share on other sites
well, I have no paypal so the first thing is for you to determine where your paypal module gets its total from.

 

Hello Amanda,

 

I visited a few sites of this topic's posters and I didn't find any (mine included obviously lol) working like yours. These are my bugs:

 

1. "Buy Product1 and Product2" on my product_info.php url

When I click on one of those links "Product1" or "Product2", the module doesn't add it to the cart. It does only on your website (most of us have that bug).

 

2. When I click on Add to cart of a single product, it adds directly the 2 products to the cart (i am the only one to have that bug actually)

 

3. A suggestion:

Could you please post a complete CLEAN package of this contrib? It's one of the top5 contrib of osCommerce and I think it deserves all our attention BECAUSE the one posted by Jenso causes a critical error: 1054 due to his product_info.php sample.

 

4. Addon Shopping cart:

I installed the add-on too. It works well although my second product's image never displays completely. Seems to be a problem in the height of my shopping cart row because I can't see a piece of the second image. It's just crushed and I don't know how to change the height.

 

Here is my product_info.php

 

<?php
/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// BOF: WebMakers.com Changed: Header Tag Controller v2.5.2
// Replaced by header_tags.php
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
 <title><?php echo TITLE; ?></title>
<?php
}
// EOF: WebMakers.com Changed: Header Tag Controller v2.5.2
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
  <tr>
	<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 } else {
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}

if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
  $products_name = $product_info['products_name'];
}
?>
  <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>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

  <tr>
	<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

		  </td>
		</tr>
	  </table>
<?php
}
?>
	  <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>
	  <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
	$products_options_array = array();
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
	while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}

	if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	} else {
	  $selected_attribute = false;
	}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
<?php
  }
?>
	  </table>
<?php
}
?>
	</td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
?>
  <tr>
	<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if (tep_not_null($product_info['products_url'])) {
?>
  <tr>
	<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
  </tr>
<?php
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<!-- bof: Add 2gether (contribution 3929) //-->
  <tr>
	<td>
<?php 
if (MODULE_2GETHER_DISCOUNT_STATUS) { 
 echo '<tr><td>';
 include(DIR_WS_MODULES . '2gether.php');
 echo '</td></tr>';
} 
?>
	</td>
  </tr>

  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<!-- eof: Add 2gether (contribution 3929) //-->
  <tr>
	<td>
<?php
//added for cross -sell
  if ( (USE_CACHE == 'true') && !SID) { 
echo tep_cache_also_purchased(3600); 
  } else { 
 include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); 
 } 
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}

?>
	</td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Thanks again for that contrib, Amanda, you are THE ONE because the combo offer is the best tool for any vendor.

Share this post


Link to post
Share on other sites
Hello Amanda,

 

I visited a few sites of this topic's posters and I didn't find any (mine included obviously lol) working like yours. These are my bugs:

 

1. "Buy Product1 and Product2" on my product_info.php url

When I click on one of those links "Product1" or "Product2", the module doesn't add it to the cart. It does only on your website (most of us have that bug).

 

2. When I click on Add to cart of a single product, it adds directly the 2 products to the cart (i am the only one to have that bug actually)

 

3. A suggestion:

Could you please post a complete CLEAN package of this contrib? It's one of the top5 contrib of osCommerce and I think it deserves all our attention BECAUSE the one posted by Jenso causes a critical error: 1054 due to his product_info.php sample.

 

4. Addon Shopping cart:

I installed the add-on too. It works well although my second product's image never displays completely. Seems to be a problem in the height of my shopping cart row because I can't see a piece of the second image. It's just crushed and I don't know how to change the height.

 

 

Thanks again for that contrib, Amanda, you are THE ONE because the combo offer is the best tool for any vendor.

 

 

1) no it does not on my site, either link takes you to their respective product info page

 

2) because you have a <form> mixup with the default product_info.php. in that file the cart form starts way up in the page and ends way down, totally unnecessary. but 2gether discount has its own form so now you have a form in a form, not good. so move your </form> statement above the 2gether module inclusion.

 

3) what 1054?

 

4) can you show that ?


Treasurer MFC

Share this post


Link to post
Share on other sites

Hi Amanda,

 

The 2 gether module creates a link on the image which opens the popup-image window.

 

I created an extra page with all the 2gether specials. I want the picture to open the productinfo in stead of the popup image. I tried to change the code but I'm afraid I need your help again.

 

thanks in advance!

Share this post


Link to post
Share on other sites
PS: this is the page with the 2gether specials

http://www.allesvoordekeuken.nl/catalog/2gether_specials.php

 

any idea why the link of the popup doesn't work anyway?

 

well, you change the js popup stuff (between the <script></noscript>):

 

<script language="javascript"><!--

document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_a['products_id']) . 'ℑ=0\\\')">' . tep_image(DIR_WS_IMAGES . $product_a['products_image'], str_replace('\'','`',$product_a['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_a['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_a['products_image'], str_replace('\'','`',$product_a['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>

</noscript>

 

into a simple link:

 

<?php

echo '<a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='.$product_a['products_id']).'">'.tep_image(DIR_WS_IMAGES . $product_a['products_image'], str_replace('\'','`',$product_a['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>';

?>

 

you have to do the same for product b ofcourse.


Treasurer MFC

Share this post


Link to post
Share on other sites

Hello,

 

I have a lot of products with 2gether discount, and my problem is that if I put in the shopping cart 3 products that I have with discount, it makes more discount. Example:

 

2gether discounts:

 

Product 1 is with Product 2

Products 1 is with Product 3

Product 2 is with Product 3

 

Then when I buy Product 1, 2 and 3 together, it makes a discount to

 

Product 1-2

Product 1-3

Product 2-3

 

Then the total discount is the double of the discount that I want. :(

 

Is possible to solve this problem?

 

Thanks.

Share this post


Link to post
Share on other sites
Hello,

 

I have a lot of products with 2gether discount, and my problem is that if I put in the shopping cart 3 products that I have with discount, it makes more discount. Example:

 

2gether discounts:

 

Product 1 is with Product 2

Products 1 is with Product 3

Product 2 is with Product 3

 

Then when I buy Product 1, 2 and 3 together, it makes a discount to

 

Product 1-2

Product 1-3

Product 2-3

 

Then the total discount is the double of the discount that I want. :(

 

Is possible to solve this problem?

 

Thanks.

 

well, there was some minor reasoning behind the decision to make the official contribution a 1 to 1 relation.

 

Eventhough I gave instructions on how to bypass that restriction it does not mean I take responsibility for the consequences of such a bypass.

 

 

But still, give an example of what you get and what you wanted and maybe we can come up with something.


Treasurer MFC

Share this post


Link to post
Share on other sites

That I want is to put all the products of one of the manufacturers with 10% Discount if the client buy 2 or more products of this manufacturer, then I have put each product of this manufacturer with the other products of this manufacturer with 2gether discount, and if you only buy 2 of this products is ok, the problem is if you buy more than 2 of this products.

 

Thanks a lot.

Share this post


Link to post
Share on other sites
That I want is to put all the products of one of the manufacturers with 10% Discount if the client buy 2 or more products of this manufacturer, then I have put each product of this manufacturer with the other products of this manufacturer with 2gether discount, and if you only buy 2 of this products is ok, the problem is if you buy more than 2 of this products.

 

Thanks a lot.

 

eh, don't.

 

I would use another contribution for that, were you actually cross-linking all products from a manufacturer using 2gether discount ? That would take forever.

 

install easy discount and then we can solve the condition.


Treasurer MFC

Share this post


Link to post
Share on other sites

I'm trying now with Category Discount, because all the products of this manufacturer are in the same category too. I have wrotten a reply in the forum of Category Discount.

 

Thank you.

Share this post


Link to post
Share on other sites
simple:

 

create a new page or use an existing one and add :

 

<?php

$mtm= rand();

$tq = tep_db_query("select product_1_id from " . TABLE_2GETHER . " where status = 1 and discount > 0 order by rand($mtm) ");

while ($tg = tep_db_fetch_array($tq)) {

$together_id = $tg['product_1_id'];

include(DIR_WS_MODULES . '2gether.php');

}

?>

 

Hi thanks for the contribution.

 

I have got it to work fine, except for the 2gether page with all specials on it. It displays the same 2gether specials several times. Does anyone know how yo solve this?

Share this post


Link to post
Share on other sites
Hi thanks for the contribution.

 

I have got it to work fine, except for the 2gether page with all specials on it. It displays the same 2gether specials several times. Does anyone know how yo solve this?

 

you have multiple product_1_id with the same id ?


Treasurer MFC

Share this post


Link to post
Share on other sites

Hello Amanda,

 

I have this problem in my shopping_cart.php (2gether addon):

Warning: Division by zero in /home/user/public_html/onoff/includes/functions/html_output.php on line 117

 

My html_output.php on line 97 to 117 is:

	// Get the image's information
if ($image_size = @getimagesize($src)) { 

  $ratio = $image_size[1] / $image_size[0];

  // Set the width and height to the proper ratio
  if (!$width && $height) { 
	$ratio = $height / $image_size[1]; 
	$width = intval($image_size[0] * $ratio); 
  } elseif ($width && !$height) { 
	$ratio = $width / $image_size[0]; 
	$height = intval($image_size[1] * $ratio); 
  } elseif (!$width && !$height) { 
	$width = $image_size[0]; 
	$height = $image_size[1]; 
  } 

  // Scale the image if not the original size
  if ($image_size[0] != $width || $image_size[1] != $height) { 
	$rx = $image_size[0] / $width; 
	$ry = $image_size[1] / $height;

Thanks in advance

Share this post


Link to post
Share on other sites
Hello Amanda,

 

I have this problem in my shopping_cart.php (2gether addon):

Warning: Division by zero in /home/user/public_html/onoff/includes/functions/html_output.php on line 117

 

My html_output.php on line 97 to 117 is:

	// Get the image's information
if ($image_size = @getimagesize($src)) { 

  $ratio = $image_size[1] / $image_size[0];

  // Set the width and height to the proper ratio
  if (!$width && $height) { 
	$ratio = $height / $image_size[1]; 
	$width = intval($image_size[0] * $ratio); 
  } elseif ($width && !$height) { 
	$ratio = $width / $image_size[0]; 
	$height = intval($image_size[1] * $ratio); 
  } elseif (!$width && !$height) { 
	$width = $image_size[0]; 
	$height = $image_size[1]; 
  } 

  // Scale the image if not the original size
  if ($image_size[0] != $width || $image_size[1] != $height) { 
	$rx = $image_size[0] / $width; 
	$ry = $image_size[1] / $height;

Thanks in advance

 

this has no relation to 2gether discount


Treasurer MFC

Share this post


Link to post
Share on other sites
this has no relation to 2gether discount

It happens only with the addon 2gether shopping cart. When I use the normal shopping_cart.php, everything goes well...any hint?

Share this post


Link to post
Share on other sites
It happens only with the addon 2gether shopping cart. When I use the normal shopping_cart.php, everything goes well...any hint?

that code is for displaying images and is used for all tep_image calls.

 

show you shopping_cart.php


Treasurer MFC

Share this post


Link to post
Share on other sites
that code is for displaying images and is used for all tep_image calls.

 

show you shopping_cart.php

 

Here is the beast:

<?php

/*

$Id: shopping_cart.php,v 1.73 2003/06/09 23:03:56 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require("includes/application_top.php");

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_2GETHER); // Added 2gether (contribution 3929)

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script type="text/javascript">

<!--

function advisecustomer()

{

warn_string = <?php echo '"<b><span class=\"errorText\">'.TEXT_UPDATE_WARNING.'</span></b>"'; ?>;

 

if (document.getElementById && document.getElementById("update_warning")) {

document.getElementById("update_warning").innerHTML = warn_string;

} else if (document.all && document.all["update_warning"]) {

document.all["update_warning"].innerHTML = warn_string;

}

}

//-->

</script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top" class="bar_left"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top" class="centercolor"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?><table border="0" width="95%" cellspacing="0" cellpadding="0" align="center">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if ($cart->count_contents() > 0) {

?>

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[0][] = array('align' => 'center',

'params' => 'class="productListing-heading"',

'text' => TABLE_HEADING_REMOVE);

 

$info_box_contents[0][] = array('params' => 'class="productListing-heading"',

'text' => TABLE_HEADING_PRODUCTS);

 

$info_box_contents[0][] = array('align' => 'center',

'params' => 'class="productListing-heading"',

'text' => TABLE_HEADING_QUANTITY);

 

$info_box_contents[0][] = array('align' => 'right',

'params' => 'class="productListing-heading"',

'text' => TABLE_HEADING_TOTAL);

 

$any_out_of_stock = 0;

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

// Push all attributes information in an array

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

while (list($option, $value) = each($products[$i]['attributes'])) {

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . $products[$i]['id'] . "'

and pa.options_id = '" . $option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $value . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

and poval.language_id = '" . $languages_id . "'");

$attributes_values = tep_db_fetch_array($attributes);

 

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

$products[$i][$option]['options_values_id'] = $value;

$products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];

$products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];

$products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];

}

}

}

 

$together_offer_ok = false; // Added 2gether (contribution 3929)

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

//// bof: Added 2gether (contribution 3929)

$together_offer = false;

$together_this_done = false;

$together_recommend = false;

$together_products_query = tep_db_query("select product_1_id, product_2_id, discount, type from " . TABLE_2GETHER . " where status = 1 ");

while ($together_products = tep_db_fetch_array($together_products_query)) {

if ($together_products['product_1_id'] == $products[$i]['id']) {

if (!$cart->in_cart($together_products['product_2_id'])) {

$together_pid = $together_products['product_2_id'];

if ($together_products['discount'] > 0) {

$together_offer = true;

} else {

$together_recommend = true;

}

} elseif ($together_products['discount'] > 0) {

$together_offer_ok = true;

$together_this_done = true;

}

} elseif ($together_products['product_2_id'] == $products[$i]['id']) {

if (!$cart->in_cart($together_products['product_1_id'])) {

$together_pid = $together_products['product_1_id'];

if ($together_products['discount'] > 0) {

$together_offer = true;

} else {

$together_recommend = true;

}

} elseif ($together_products['discount'] > 0) {

$together_offer_ok = true;

$together_this_done = true;

}

}

}

//// eof: Added 2gether

 

if (($i/2) == floor($i/2)) {

$info_box_contents[] = array('params' => 'class="productListing-even"');

} else {

$info_box_contents[] = array('params' => 'class="productListing-odd"');

}

 

$cur_row = sizeof($info_box_contents) - 1;

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'], false,'onFocus="advisecustomer();"'));

 

$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .

' <tr>' .

' <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .

' <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

 

if (STOCK_CHECK == 'true') {

$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);

if (tep_not_null($stock_check)) {

$any_out_of_stock = 1;

 

$products_name .= $stock_check;

}

}

//// bof: Added 2gether (contribution 3929)

//// here the box will show show

if ($together_offer) {

$together_pid_query = tep_db_query("select p.products_image,

pd.products_name

from " . TABLE_PRODUCTS . " p,

" . TABLE_PRODUCTS_DESCRIPTION . " pd

where p.products_id = '" . $together_pid . "' and

p.products_id = pd.products_id and

pd.language_id = '" . $languages_id . "' and

p.products_status = '1'");

$together = tep_db_fetch_array($together_pid_query);

 

$products_name .= '<br><table class="borderGray" cellpadding="2" bgcolor="#ffffff"><tr><td class="smalltext" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $together_pid) . '#b2"><img src="images/save-icon_sm.gif" border="0" style="vertical-align:middle" alt="2gether" title="2gether"> ' . '2<i>gether</i> ' . SPECIALS . ' <img src="images/save-icon_sm.gif" border="0" style="vertical-align:middle" alt="2gether" title="2gether"><br>' .tep_image(DIR_WS_IMAGES . $together['products_image'], $together['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HIGHT).'<br</a><br><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'action=buy_now&products_id=' . $together_pid) . '"><img src="includes/languages/' . $language . '/images/buttons/button_buy_now.gif" alt="'.IMAGE_BUTTON_BUY_NOW.'" border="0"></a></td></tr></table>';

} elseif ($together_recommend) {

$together_pid_query = tep_db_query("select p.products_image,

pd.products_name

from " . TABLE_PRODUCTS . " p,

" . TABLE_PRODUCTS_DESCRIPTION . " pd

where p.products_id = '" . $together_pid . "' and

p.products_id = pd.products_id and

pd.language_id = '" . $languages_id . "' and

p.products_status = '1'");

$together = tep_db_fetch_array($together_pid_query);

 

$products_name .= '<br><table cellpadding="2" bgcolor="#ffffff"><tr><td class="smalltext" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $together_pid) . '#b2">'.BUY_TWO_HEADING_TEXT_SUGGESTION.'<br>' .tep_image(DIR_WS_IMAGES . $together['products_image'], $together['products_name']).'<br><a href="' . tep_href_link(FILENAME_SHOPPING_CART, 'action=buy_now&products_id=' . $together_pid) . '"><img src="includes/languages/' . $language . '/images/buttons/button_buy_now.gif" alt="'.IMAGE_BUTTON_BUY_NOW.'" border="0"></a></td></tr></table>';

} elseif ($together_this_done) {

$products_name .= '<br><img src="images/save-icon_sm.gif" border="0" style="vertical-align:middle" alt="2gether discount" title="2gether discount">';

}

 

//// eof: Added 2gether

 

if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {

reset($products[$i]['attributes']);

while (list($option, $value) = each($products[$i]['attributes'])) {

$products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';

}

}

 

$products_name .= ' </td>' .

' </tr>' .

'</table>';

 

$info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',

'text' => $products_name);

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" onFocus="advisecustomer();"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

//TotalB2B start

$info_box_contents[$cur_row][] = array('align' => 'right',

'params' => 'class="productListing-data" valign="top"',

'text' => '<b>' . $currencies->display_price_nodiscount($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');

//TotalB2B end

 

}

 

new productListingBox($info_box_contents);

?>

</td>

</tr>

<tr>

<!-- start Customer Update Cart Reminder 2.0 -->

<td class="main">

<table width="100%" cellpadding="1" cellspacing="0" border="0">

<tr>

<td class="main">

<script type="text/javascript">

<!--

if (!(document.getElementById) && !(document.all)) {

document.write("<b><span class=\"errorText\"><?php echo TEXT_UPDATE_WARNING; ?></span>");

}

else {

document.write("<span id=\"update_warning\" class=\"errorText\">?</span>");

}

//-->

</script>

<noscript>

<b><span class="errorText"><?php echo TEXT_UPDATE_WARNING; ?></span></b>

</noscript>

</td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right" class="main" valign="top" nowrap><b>

<?php echo SUB_TITLE_SUB_TOTAL; ?> <?php

 

//TotalB2B start

global $customer_id;

$query_price_to_guest = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key = 'ALLOW_GUEST_TO_SEE_PRICES'");

$query_price_to_guest_result = tep_db_fetch_array($query_price_to_guest);

if ((($query_price_to_guest_result['configuration_value']=='true') && !(tep_session_is_registered('customer_id'))) || ((tep_session_is_registered('customer_id')))) {

echo $currencies->format($cart->show_total());

} else {

echo PRICES_LOGGED_IN_TEXT;

}

//TotalB2B end

 

?></b></td>

</tr>

</table>

</td>

<!-- end Customer Update Cart Reminder 2.0 -->

 

<!-- bof: Added 2gether (contribution 3929) //-->

<?php

if ($together_offer_ok) {

echo '<tr><td class="smalltext" align="center"><img src="images/save-icon_sm.gif" border="0" style="vertical-align:middle" alt="2gether discount" title="2gether discount">?Receive Your 2<i>gether</i> Discount at Checkout?<img src="images/save-icon_sm.gif" border="0" style="vertical-align:middle" alt="2gether discount" title="2gether discount"></td></tr>';

echo '<tr><td>'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td></tr>';

}

?>

<!-- eof: Added 2gether //-->

<?php

if ($any_out_of_stock == 1) {

if (STOCK_ALLOW_CHECKOUT == 'true') {

?>

<tr>

<td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>

</tr>

<?php

} else {

?>

<tr>

<td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>

</tr>

<?php

}

}

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>

<?php

$back = sizeof($navigation->path)-2;

if (isset($navigation->path[$back])) {

?>

<td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

<?php

}

?>

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

} else {

?>

<tr>

<td align="center" class="main"><?php new infoBox(array(array('text' => TEXT_CART_EMPTY))); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

}

?>

</table></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top" class="bar_right"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Thanks, Amanda

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

×