Contributions
2gether discount
2gether discount:
-link 2 products together with a money or percentage discount.
-zero discount displays as a recommendation like a 1on1 xsell
-Discount is given at checkout.
Expand All / Collapse All
This is a complete package.
+ Changed the functionality to allow one item to be paired
with many other items. So offers like Buy any style Hat and
and style Scarf together, get a discount.
+ Removed some cross contribution contamination
+ Updated all the files to osCommerce Online Merchant RC2a
+ Finished the Attributes compatibility started by jaderrosa 31 Dec 2008
+ Added compare file for the shopping cart addon from amanda
+ Added missing text definition in the admin language files.
+ Added required GNU release info
+ Removed stock check in application_top.php since that
ends up overriding the shop's settings.
+ Started changelog
Support:
http://forums.oscommerce.com/index.php?showtopic=189495
I added support for attributes in this mod.
I not tested 100% but I think there are no bugs.
For update look in catalog/includes/application_top.php for:
$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']);
Replace for:
$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']);
Replace catalog/includes/modules/2gether.php
-taxfix from 2.01 gave wrong output, put in fix found in forum
-added dutch languagefiles
-corrected "action=assiungi" (replaced by "action=add_product") in modules/2gether.php
-replaced hardcoded text with languagedependent text in modules/2gether.php
2gether discount 2.01
-tax fix applied
-</form> tag position changed in the included product_info.php file
-instructions updated
-italian and german languages added
-stylesheet classes added
The product_info.php is in fact a big <form> so, while editing this file to insert the 2gether code, you must pay attention to put the 2gether code after the </form> that already exist on product_info.
If you fail to do that, your customers will not be able to add just one of the products to the cart and all buttons on product_info.php will add both products to the cart.
solution:
look for </form> at the very end of product_info.php and remove it.
add </form> just after :
<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>
that will make sure that the normal add to cart form is closed before the 2gether form is opened.
This will resolve the way that tax is calculated. With the previous versions, tax was calculated BEFORE the 2gether discount, which causes customers to be charged too much tax.
This is a simple fix and I give FULL credit to "Marizka" for this fix. I simply posted it here because nobody has posted the fix here or in the support forum.
Only 1 file to update:
includesmodulesorder_totalot_together.php
Enjoy!
This is like the package below but with better install instructions. Thank you Amanda!
You might find a double post of this upload, the reason is that the first file was just a little of 300K, so this is the same but just under 300K.
Sorry!!!
------------------------
This should be a full version, including all files and most of the changes mentioned in the forum or posted here.
There is NOTHING NEW here.
I only tried to put it all together for you to download in one file.
what is in here?
*** the needed files to make 2gether work on your store.
*** the changes from 16. Jan
*** as extra the change for your shopping cart including the screen shots.
*** an instruction to add quantity input to your product_info.php and to make it work with this contribution.
replace file includes/languages/modules/english/2gether.php
with this file
replace includes/modules/2gether.php
replace includes/modues/order_total/2gether.php with ot_together.php
uninstall & reinstall
should work for default installs
with tax
with option for product original prices
1 query reduction
so you know what it is supposed to look like
add 2gether reference to shopping_cart.php
if you wish to automatically disable the 2gether entry if 1 of the products is sold (together or not) you add this code to checkout_process.php:
// disable 2gether products entry
$together_query = tep_db_query("select status from " . TABLE_2GETHER . " where status = 1 and (product_1_id = '" . tep_get_prid($order->products[$i]['id']) . "' or product_2_id = '" . tep_get_prid($order->products[$i]['id']) . "')");
if (tep_db_num_rows($together_query) > 0) {
tep_db_query("update " . TABLE_2GETHER . " set status = 0 where status = 1 and (product_1_id = '" . tep_get_prid($order->products[$i]['id']) . "' or product_2_id = '" . tep_get_prid($order->products[$i]['id']) . "')");
}
missed in the instructions:
in application_top.php add in the big case :
case 'buy_tinnx' : if (isset($_GET['products_id'])) {
if (tep_has_product_attributes($_GET['products_id'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']));
} else {
if (tep_get_products_stock($_GET['products_id']) > 0) {
$cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);
}
}
}
if (isset($_GET['buy_tinn_add'])) {
if (tep_has_product_attributes($_GET['buy_tinn_add'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['buy_tinn_add']));
} else {
if (tep_get_products_stock($_GET['buy_tinn_add']) > 0) {
$cart->add_cart($_GET['buy_tinn_add'], $cart->get_quantity($_GET['buy_tinn_add'])+1);
}
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
so that both products are added to the basket.
2gether discount:
-link 2 products together with a money or percentage discount.
-zero discount displays as a recommendation like a 1on1 xsell
-Discount is given at checkout.
Note: Contributions are used at own risk.