Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

2gether Discount


boxtel

Recommended Posts

Since I like to use the product pictures as links instead of popup the images

i added a switch to V2.04 (added from surfalot on 4 Aug 2009):

 

LOOK FOR (Line 7):

 

$show_original_prices = true; // show original prices of the products

 

ADD STRAIGHT AFTER:

 

$show_images_as_links = true; // show images as links instead of popup the image

 

REPLACE (Lines 83-89):

 

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

document.write('<?php echo '<a href="javascript: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>

<?php

 

WITH THIS:

 

<?php #show images as link ...

if ($show_images_as_links) {

echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_a['products_image']) . '">' . ' <a href="' . tep_href_link('product_info.php', '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>';}

else { #... instead of popup the image

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

document.write('<?php echo '<a href="javascript: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>

<?php

}

 

AND REPLACE (Lines 126-132) FOR THE SECOND PICTURE:

 

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

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_b['products_id']) . 'ℑ=0\\\')">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['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_b['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>

</noscript>

<?php

 

WITH THIS:

 

if ($show_images_as_links) {

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

} else { ?>

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

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_b['products_id']) . 'ℑ=0\\\')">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['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_b['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>

</noscript>

<?php

}

 

 

All credits to the author for this nice contrib. And also credits to the community for this interesting discussion.

 

Sincerely,

heranke.com

Recommended SEO Addons:

Most Important: Header Tags SEO - Ultimate SEO V 2.2d

Recommended Addons:

Also Purchased (AP) Preselection - Contribution 3294

Link to comment
Share on other sites

  • 2 months later...

Hello,

 

I found a bug in this contribution. I noticed that if a product has a special price then the 2gether discount is being count on the normal price. The discount is being displayed on the product page and is wrong. Here is an example:

 

Product A normal price 100$ and special price 80$

Product B normal price 100$ without special price

 

You set 2gether discount 10%

 

The right price should be 162$ and discount 18$ and this should be displayed on the product page, but is not.

 

It is being displayed 180$ and discount 20$ what is completly wrong.

 

In the checkout confirmation page:

- the total price before discount is 180$ (this is right)

- the 2gether discount is 20$ (what is wrong)

- the total price after discount is 160$ (what is wrong)

 

Any clue how to fix it?? I would appreciate. Hope you'll understand what I mean.

Link to comment
Share on other sites

  • 1 month later...

Hello,

I found a bug in this contribution. I noticed that if a product has a special price then the 2gether discount is being count on the normal price.

 

I have the same issue with this awesome contribution. 2.04 installed; Everything seems perfect so far except that the 2gether offer is not showing the products specials price (if exists), so therefore is taking the normal price plus the 2nd item price to calculate the "together for only" price..

 

Could anyone suggest a fix?

 

Thank you

-Dave

Link to comment
Share on other sites

fixed - note the red <?php

 

Since I like to use the product pictures as links instead of popup the images

i added a switch to V2.04 (added from surfalot on 4 Aug 2009):

 

LOOK FOR (Line 7):

 

$show_original_prices = true; // show original prices of the products

 

ADD STRAIGHT AFTER:

 

$show_images_as_links = true; // show images as links instead of popup the image

 

REPLACE (Lines 83-89):

 

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

document.write('<?php echo '<a href="javascript: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>

<?php

 

WITH THIS:

 

<?php #show images as link ...

if ($show_images_as_links) {

echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_a['products_image']) . '">' . ' <a href="' . tep_href_link('product_info.php', '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>';}

else { #... instead of popup the image

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

document.write('<?php echo '<a href="javascript: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>

<?php

}

 

AND REPLACE (Lines 126-132) FOR THE SECOND PICTURE:

 

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

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_b['products_id']) . 'ℑ=0\\\')">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['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_b['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>

</noscript>

<?php

 

WITH THIS:

<?php

if ($show_images_as_links) {

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

} else { ?>

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

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_b['products_id']) . 'ℑ=0\\\')">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['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_b['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>

</noscript>

<?php

}

 

 

All credits to the author for this nice contrib. And also credits to the community for this interesting discussion.

 

Sincerely,

heranke.com

-Dave

Link to comment
Share on other sites

hello, I installed this contribution and all goes well, only to insert the products it the following error "Fatal error: Call to undefined function tep_get_products_price () in / home/acessogc/public_html/loja/admin/2gether.php on line 268"

and I can not do anything else. or aparecece in produt_info.php.

 

Someone know how to help me?

 

site is http://acessog3.com.br.

 

Grateful!

Link to comment
Share on other sites

hello, I installed this contribution and all goes well, only to insert the products it the following error "Fatal error: Call to undefined function tep_get_products_price () in / home/acessogc/public_html/loja/admin/2gether.php on line 268"

and I can not do anything else. or aparecece in produt_info.php.

 

Someone know how to help me?

 

site is http://acessog3.com.br.

 

Grateful!

****************

It worked with version 2.04 of Jarderrosa.

 

thanks.

****************

Link to comment
Share on other sites

I have the same issue with this awesome contribution. 2.04 installed; Everything seems perfect so far except that the 2gether offer is not showing the products specials price (if exists), so therefore is taking the normal price plus the 2nd item price to calculate the "together for only" price..

 

Could anyone suggest a fix?

 

Thank you

 

 

Would anyone be able to point me in the right direction? I am sure I can sort it if kicked in the right direction...

 

i.e. If a product "A" special price exists, use specials price rather than the default when adding A + B

-Dave

Link to comment
Share on other sites

New version 2.04.1 with SPPC compatability

 

http://addons.oscommerce.com/info/3929

 

Changes:

- SPPC compatible!

- Store Specials now carry into 2gether, independent of 2gether offers.

- Bug fix to $_GET

- Show images as link to product instead of popping up the image

- modifed $products_options_query with . " order by pa.options_values_price, pa.products_attributes_id" as a sort order fix (this can be removed if not wanted)

-Dave

Link to comment
Share on other sites

Here is a challenging question:

 

I have an issue with this contribution, not because there is anything wrong with it, but because of the way my store is set up.

 

I have Master Products Module (http://addons.oscommerce.com/info/1681) which allows you to assign a product as a 'master', and other

products as slaves. These all display listed below the master product in product_info with a quantity select for each

item, and a single add to cart button. It is great for products with different sizes.

 

2gether discount module works when someone arrives at a product page where the owner has a 2gether discount added to it. I dont have such thing as all my product pages are actually Master products that list individual products (slaves) in it. So here is the question:

 

What would I have to change so that the module appears not on the product_id pages but on the master of such product_id?

 

I know its quite a challenge, but Im hoping someone might be able to guide me as this module could be very beneficial.

 

Thanks in advance

 

Ricardo

Link to comment
Share on other sites

  • 4 weeks later...

I am having the same problem as the poster below regarding the QT PRO with 2gether. I am having trouble with the application_top.php since is was modified for the QT PRO. Does anyone have a working PHP for this issue or point me in the right direction?

 

Thanks,

Vin.

 

 

 

 

Posted 18 September 2007 - 02:01 PM

 

Hi guyz... same problem here..... how can we setup QTPRO with 2gether

 

qtpro

 

Quote

 

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id']) && ($HTTP_POST_VARS['products_id']==(int)$HTTP_POST_VARS['products_id'])) {

//++++ QT Pro: Begin Changed code

$attributes=array();

if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {

$attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);

foreach ($attrlist as $attr) {

list($oid, $oval)=explode('-',$attr);

if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)

$attributes[$oid]=$oval;

}

}

if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {

foreach ($HTTP_POST_VARS['id'] as $key=>$val) {

if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)

$attributes=$attributes + $HTTP_POST_VARS['id'];

}

}

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);

//++++ QT Pro: End Changed Code

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

 

 

2gether

 

 

Quote

 

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

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

if (tep_get_products_stock($HTTP_POST_VARS['products_id']) > 0) $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

if (isset($HTTP_POST_VARS['buy_tinn_add']) && is_numeric($HTTP_POST_VARS['buy_tinn_add'])) {

if (tep_get_products_stock($HTTP_POST_VARS['buy_tinn_add']) > 0) {

$cart->add_cart($HTTP_POST_VARS['buy_tinn_add'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['buy_tinn_add'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

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

 

 

 

How make this work "2gether"?

Link to comment
Share on other sites

The exact issue is when a product is assigned attribute such as COLOR, i would get the error message below when trying to "add to cart" for the attributed product or "buy now" with the 2gether discounts Product A + Product B.

 

 

ERROR MESSAGE:

"The combination of the options you have selected is currently out of stock. please select another combination"

 

I am positive the product has 1000 stocks.

 

 

I have also tried other scenarios below.

 

Product A (with attribute color) = ERROR message above

Product A (with attribute color) + Product B (without attribute) = ERROR message above

 

If i try the combination below, it works fine.

Product B (without attribute) + Product A (with attribute) = This works fine

 

 

Does anyone know how to fix this?

 

Many Thanks.

Link to comment
Share on other sites

This is a really great contribution and thank you for your effort releasing this contribution. I am so eager to get it to work right, but it is way over my head right now. I am hoping someone could provide some help and point me in the right direction. below is what i have in the Application_top.php after combining the 2gether and QT PRO code. any help will be much appreciated. Thanks....

 

 

 

 

 

 

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

// if (tep_get_products_stock($HTTP_POST_VARS['products_id']) > 0)

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

 

 

//++++ QT Pro: Begin Changed code

$attributes=array();

if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {

$attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);

foreach ($attrlist as $attr) {

list($oid, $oval)=explode('-',$attr);

if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)

$attributes[$oid]=$oval;

}

}

if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {

foreach ($HTTP_POST_VARS['id'] as $key=>$val) {

if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)

$attributes=$attributes + $HTTP_POST_VARS['id'];

}

}

 

if (isset($HTTP_POST_VARS['buy_tinn_add']) && is_numeric($HTTP_POST_VARS['buy_tinn_add'])) {

//if (tep_get_products_stock($HTTP_POST_VARS['buy_tinn_add']) > 0) {

$cart->add_cart($HTTP_POST_VARS['buy_tinn_add'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['buy_tinn_add'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id_b']);

//}

 

 

 

 

//++++ QT Pro: End Changed Code

 

 

 

 

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

Link to comment
Share on other sites

  • 1 month later...

I am looking for a contribution that will allow me to add six products to the shopping basket all of which are part of a christmas stocking group. When the user has added six of these products in their shopping basket it will automatically deduct either a percentage or value. Is this kind of thing possible with this contribution?

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hello,

 

In product_info.php I have add:

<?php 
if (MODULE_2GETHER_DISCOUNT_STATUS) {

?>
echo '

       <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber27">

           <tr>

               <img border="0" src="images/image.gif" width="216" height="29" style="vertical-align:bottom"></a></td>

<tr><td>';


 include(DIR_WS_MODULES . '2gether.php');
 echo '</td></tr></table>';
} 
?> 

 

How can I do to (src="images/image.gif) show only if 2gether status is true?

Link to comment
Share on other sites

  • 2 weeks later...

Hello, I have some problem.

In product info 2gether discount show correct discount, that what i am set in admin, but when i push buy now and redirect to shoping cart prices stll without discount.

Where is in code, or on admin page i should search these setups ?

Edited by Sun_ua
Link to comment
Share on other sites

  • 1 month later...

I need help in shopping_cart.php

 

   <td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b>
                 <?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"> ' . TOGETHER_TEXT_RECEIVE_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>';
} 
?>

 

Sub-total discount does not appear in shopping cart, what should I have done wrong ??

 

Thank's for help.

Link to comment
Share on other sites

  • 4 weeks later...

Is there a option to put the 2gether products in to the database of specials.php?

 

So when i make a special of 2 products with a discount it wil show in special offers.

 

I've a link in my categories to special.php and i want to show how many products are in that catgorie between ().

 

For Example:

Special Offer (2) =in dutch "Aanbiedingen"

 

I've installed the next contri:

http://addons.oscommerce.com/info/6262

 

and i've removed al database links, because of an error. And could someone give the code for the right database?

 

Thanx

 

Tjappie W

NL ( shop: http://www.cosmeanailart.nl/webshop )

Edited by Tjappie W

osC version: 2.2 MS2 060817

 

Own addons installed:

iOSC3 v4.01 - Discount Coupon Codes for iSOC3 - Points and Reward for iOSC3 - Purchase witouth Account for iOSC3

 

Installed addons:

will follow.....

Link to comment
Share on other sites

Is there a option to put the 2gether products in to the database of specials.php?

 

So when i make a special of 2 products with a discount it wil show in special offers.

 

I've a link in my categories to special.php and i want to show how many products are in that catgorie between ().

 

For Example:

Special Offer (2) =in dutch "Aanbiedingen"

 

I've installed the next contri:

http://addons.oscommerce.com/info/6262

 

and i've removed al database links, because of an error. And could someone give the code for the right database?

 

Thanx

 

Tjappie W

NL ( shop: http://www.cosmeanailart.nl/webshop )

 

I use currently the script from post #65, this script doesn't count the products.

osC version: 2.2 MS2 060817

 

Own addons installed:

iOSC3 v4.01 - Discount Coupon Codes for iSOC3 - Points and Reward for iOSC3 - Purchase witouth Account for iOSC3

 

Installed addons:

will follow.....

Link to comment
Share on other sites

  • 2 weeks later...

Hi!

I have this cont installed and i love it, it's exactly want i needed! Thanks. But there's 1 problem i can't solve and i already look all over this forum for answers.. did'nt find it so i hope someone can help me here:

 

When i have the product A together with 3 other products for example - so, 3 diferent packs with the same product A - at the product A page it only appears one of those 3... of course, i would like it to show ALL the 2gether possibilities for that A product so the costumer can know the ofers...

 

How do i do it? It must be simple but i can't find the way...

 

Thanks

Link to comment
Share on other sites

1) in admin 2gether.php remove the exclude queries like:

 

$excludes_array1 = array();

// $exclude_query1 = tep_db_query("select product_1_id from " . TABLE_2GETHER);

// while ($excludes1 = tep_db_fetch_array($exclude_query1)) {

// $excludes_array1[] = $excludes1['product_1_id'];

// }

$excludes_array2 = array();

// $exclude_query2 = tep_db_query("select product_2_id from " . TABLE_2GETHER);

// while ($excludes2 = tep_db_fetch_array($exclude_query2)) {

// $excludes_array2[] = $excludes2['product_2_id'];

// }

 

$excludes_array = array_merge($excludes_array1,$excludes_array2);

 

2) would suggest to put an order by into the queries so you can easily see the duplicates

 

3) in the display module change the if into a while like :

 

//$num_together = tep_db_num_rows($together_query);

//if ($num_together > 0) {

// $record = tep_db_fetch_array($together_query);

while ($record = tep_db_fetch_array($together_query)) {

$discount = $record['discount'];

 

that way you can have as many as you want but not connect a product to itself.

 

 

I wanted to do this hanges either but it didn't work for me, don't know why....

The first step is OK but the 3rd (display module) doesn't work: the layout of my site gets all wrong, the rigth column is all crazy, the boxes of different sizes.. a mess! What could it be wrong?

Link to comment
Share on other sites

  • 1 month later...

Hi guys, I'm having trouble with the module. For some reason the discount is always getting multiplied by two on the checkout_confirmation page. If I arrange the sort orders of the order_total modules so that the discount is added after the 'total' it works fine. Any ideas on what maybe going wrong? Ideally I would like:

 

Sub-total

Discount

Total

Link to comment
Share on other sites

  • 1 month later...

I've followed the instructions to make the images smaller in the cart (they're HUGE) but they are still the same after I made the changes. What am I doing wrong? I posted my includes/modules/2gether.php file here.

 

<?php

// This file is /includes/modules/2gether.php v2.04 + now SPPC compatible (credit to Jan Zonjee) + show images as links instead of popup the image

if (!$together_id) $together_id = (int)$_GET['products_id'];  // added (int)
if ($together_id) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products
$show_images_as_links = true; // show images as links instead of popup the image
?>
<tr>
<td>
<div id="gether">
<?php
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id = '" . $together_id . "' or product_2_id = '" . $together_id . "') and status = 1");
$num_together = tep_db_num_rows($together_query);
if ($num_together > 0) {
 $record = tep_db_fetch_array($together_query);
 $discount = $record['discount'];
 $discount_type = $record['type'];
 if ($record['product_1_id'] == $together_id) {
   $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."'";
   $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."'";
 } else {
    $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."'";
    $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."'";
 }

// BOF SPPC
 $list_of_prdct_ids = array($record['product_1_id'], $record['product_2_id']);

     if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
      $customer_group_id = $_SESSION['sppc_customer_group_id'];
	} else {
	  $customer_group_id = '0';
    }
// EOF SPPC

 $product_a_query = tep_db_query($aq);
 $product_a = tep_db_fetch_array($product_a_query);
 $product_b_query = tep_db_query($bq);
 $product_b = tep_db_fetch_array($product_b_query);
 $product_a_price = $product_a['products_price'];
 $product_b_price = $product_b['products_price'];

// BOF SPPC - specials
// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
    $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id in (" . implode(',', $list_of_prdct_ids) . ") and pg.customers_group_id = '".$customer_group_id."'");
         while ($pg_array = tep_db_fetch_array($pg_query)) {
		     $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
			}

  for ($x = 0; $x < 2; $x++) {

// replace products prices with those from customers_group table
    if(!empty($new_prices)) {
        for ($i = 0; $i < count($new_prices); $i++) {
		  if ($product_a['products_id'] == $new_prices[$i]['products_id'] ) {
		      $product_a_price = $new_prices[$i]['products_price'];
			 }
		  if ($product_b['products_id'] == $new_prices[$i]['products_id'] ) {
			  $product_b_price = $new_prices[$i]['products_price'];
             }
        }  // end for ($i = 0; $i < count($new_prices); $i++) {
  }  // end if(!empty($new_prices)
  }  // end for ($x = 0; $x < count($new_prices); $x++)}   
}  // end if ($customer_group_id != '0')

// an extra query is needed for all the specials
       $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") and status = '1' and customers_group_id = '" .$customer_group_id. "' ");
	        while ($specials_array = tep_db_fetch_array($specials_query)) {
               $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price']);
		    }

// replace products_price with the correct specials_new_products_price
    if(!empty($new_s_prices)) {
    for ($x = 0; $x < 2; $x++) {
		 for ($i = 0; $i < count($new_s_prices); $i++) {
			if ($product_a['products_id'] == $new_s_prices[$i]['products_id'] ) {
			    $product_a_price = $new_s_prices[$i]['specials_new_products_price'];
			}
			if ($product_b['products_id'] == $new_s_prices[$i]['products_id'] ) {
			    $product_b_price = $new_s_prices[$i]['specials_new_products_price'];
			}
         }  // end for ($i = 0; $i < count($new_s_prices); $i++) {
       }  // end for ($x = 0; $x < 2; $x++) {
 } // end if(!empty($new_s_prices)
// EOF SPPC - specials

 if (DISPLAY_PRICE_WITH_TAX) {
   $product_a_price =  tep_add_tax($product_a_price,tep_get_tax_rate($product_a['products_tax_class_id']));
   $product_b_price =  tep_add_tax($product_b_price,tep_get_tax_rate($product_b['products_tax_class_id']));
 }

 if ($discount > 0) {

   $together_image = '<img src=' . DIR_WS_IMAGES . 'save-icon_blink.gif alt="$" title="$">';
   $together_text = TOGETHER_HEADING_TEXT_SPECIAL_OFFER . '<br>';
  if (($show_money_savings) or ($show_percentage_savings)) {
   $together_savings_string = TOGETHER_TEXT_YOU_SAVE;
  } else {
   $together_savings_string = '';
  }
   if ($discount_type == 'p') {
     $together_price = tep_round(($product_a_price + $product_b_price) * (1-($discount/100)), 1);
     if ($show_money_savings) {
          $together_savings = $product_a_price + $product_b_price - $together_price;
          $together_savings_string .= $currencies->format($together_savings);
     }
     if ($show_percentage_savings) {
          $together_savings_string .= ' ' . $discount . '%';
     }
   } else {
      $together_price = tep_round($product_a_price + $product_b_price - $discount,1);
      if ($show_money_savings) {
        $together_savings = $product_a_price + $product_b_price - $together_price;
        $together_savings_string .= $currencies->format($together_savings);
      }
      if ($show_percentage_savings) {
        $together_percentage = ($discount /($product_a_price + $product_b_price))*100;
        $together_savings_string .= ' ' . $together_percentage . '%';
      }
     }
 } else {
     $together_price = tep_round(($product_a_price + $product_b_price), 1);
     $together_savings_string = '';
     $together_image = '<img src=' . DIR_WS_IMAGES . 'info_blue_small.jpg alt="i" title="i">';
     $together_text = '<font color="orange"><span class="getslogan">'.TOGETHER_HEADING_TEXT_SUGGESTION . '</span></font><br>';
   }
$together_string = $currencies->format($together_price);
echo '<table width="99%" class="borderGray" cellpadding="2" align="center">' .
'<tr>
 <td valign="top" width="1px" align="left">' . $together_image . '</td>' . 
'<td colspan="5" class="gettitolo">' . $together_text . TOGETHER_TEXT_BUY . ' <a href="' . tep_href_link('product_info.php', 'products_id=' . $product_a['products_id']) . '">' . str_replace('\'','`',$product_a['products_name']) . ' ' . tep_image('images/ico_arrow.gif', ICON_ARROW_RIGHT) . '</a> ' . TOGETHER_TEXT_AND . ' <a href="' . tep_href_link('product_info.php', 'products_id=' . $product_b['products_id']) . '">' . str_replace('\'','`',$product_b['products_name']) . ' ' . tep_image('images/ico_arrow.gif', ICON_ARROW_RIGHT) . '</a></td>' . 
'</tr>
<tr>
 <td></td>' . 
'<td width="80px" align="center">' ;?>
<?php // show images as link ...
 if ($show_images_as_links) {
      echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_a['products_image']) . '">' . ' <a href="' . tep_href_link('product_info.php', '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>';
 } else { //... instead of popup the image
?>
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript: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']), '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']), 'hspace="5" vspace="5"') . '</a>'; ?>
</noscript> 
<?php 
}

echo tep_draw_form('together', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));

if ($show_original_prices) echo '<br><span class="prezzo">'.$currencies->format($product_a_price);

//Jader

$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)$product_a['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)$product_a['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 . "'" . " order by pa.options_values_price, pa.products_attributes_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[$product_a['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$product_a['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <?php echo '<br>' . $products_options_name['products_options_name'] . ':'; ?><br>
             <?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br>
<?php
     }

//-Jader

echo '</span></td><td align="center" width="100px"><img src="images/icon_plus.gif" border="0" style="vertical-align: middle"></td>' .
'<td width="80px" align="center">' ;?>
<?php
if ($show_images_as_links) {
echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_b['products_image']) . '">' . ' <a href="' . tep_href_link('product_info.php', 'products_id=' . $product_b['products_id']) . '">' . ' ' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>';
} else { ?>
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_b['products_id']) . 'ℑ=0\\\')">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['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_b['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_b['products_image'], str_replace('\'','`',$product_b['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>
</noscript>
<?php 
}

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

//Jader

$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)$product_b['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)$product_b['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 . "'" . " order by pa.options_values_price, pa.products_attributes_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[$product_b['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$product_b['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <?php echo '<br>' . $products_options_name['products_options_name'] . ':'; ?><br>
             <?php echo tep_draw_pull_down_menu('id_b[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br>
<?php
     }

//-Jader

echo '</span></td><td width="2%"></td>'.
'<td align="middle" nowrap valign="middle" class="getprezzo">' . TOGETHER_TEXT_TOGETHER . ' ' . '<br><font color=#00><b>'.$together_string . '</b></font><br><br>'; 
//echo tep_draw_form('together', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));

echo tep_draw_hidden_field('products_id', $product_a['products_id']) . tep_draw_hidden_field('quantity',1) . tep_draw_hidden_field('buy_tinn_add', $product_b['products_id']) . tep_image_submit('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW);
echo '</form>';
echo '<table>';
if ($discount > 0) echo '<tr><td class="getrisparmio" nowrap align="center"><br><font color="red">' . $together_savings_string . '</font></td></tr><tr><td class="vsmalltext" nowrap align="center">('. TOGETHER_TEXT_RECEIVE_CHECKOUT . ')</td></tr>';
echo '</table>';
echo '</td></tr>';
echo '</table>';

echo '</div></td></tr><tr><td class="spazio"></td></tr>';

}
}
?>

 

Thank you!

Link to comment
Share on other sites

  • 2 years later...

Hello,

 

First this is a great contribution.

I only have one problem, and this is with the product_information page.

The problem is that the total price show there is not correct.

Ex.

I have a product that is 16,99 and a product that is 17,99

When together you got a fix discount of 5

So 16,99+19,99-5=29,98

On the Product_info page this is shown as 30.

At checkout everything is fine.

 

Can somebody tell me how to fix this??

 

Thank you

Greetings,

 

Henk Bartels

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