Ja mcmannehan hat Recht. Das ist nicht nötig. Es gibt jedoch kein Modul der das macht was du willst. nicht einmal das Modul für ebenfalls gekaufte Produkte hat einen Kaufbutton
Hier eine etwas andere Lösung falls es nicht funktionieren sollte wie oben beschrieben:
application_top.php
case 'buy_now_xsell' : if (isset($_GET['products_id'])) {
if (tep_has_product_attributes($_GET['products_id'])) {
tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_GET['products_id']));
} else {
$cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);
$messageStack->add_session('product_action', sprintf(PRODUCT_ADDED, tep_get_products_name((int)$_GET['products_id'])), 'success');
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
und hier die xsell.php
<?php
/*
$Id
osCommerce, Open Source E-Commerce Solutions
<http://www.oscommerce.com>
Copyright (c) 2018 osCommerce
Released under the GNU General Public License
*/
//fixed bug
if ((USE_CACHE == 'true') && empty($SID)) {
// include currencies class and create an instance
require_once('includes/classes/currencies.php');
$currencies = new currencies();
}
if ($_GET['products_id']) {
$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price, products_baseprice, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price
from products_xsell xp left join " . TABLE_PRODUCTS . " p on xp.xsell_id = p.products_id
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'
left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id
where xp.products_id = '" . $_GET['products_id'] . "'
and p.products_status = '1'
order by sort_order asc limit " . MAX_DISPLAY_XSELL);
$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
?>
<div class="col-sm-12">
<h3><?php echo TEXT_XSELL_PRODUCTS; ?></h3>
<div class="row list-group">
<?php
$position = 1;
while ($xsell = tep_db_fetch_array($xsell_query)) {
?>
<div class="col-sm-4">
<div class="thumbnail equal-height">
<?php
// PLS Taxinfo, Shippinginfo, Baseprice start
$pls_taxinfo = ( DISPLAY_TAX_INFO == 'true' ) ? ( DISPLAY_PRICE_WITH_TAX == 'true' ) ? '<br /><span class="pls_taxInfomodules">'. sprintf(TEXT_INCL_VAT, tep_get_tax_rate($xsell['products_tax_class_id']).'%') . '</span>' : '<br /><span class="pls_taxInfomodules">' . TEXT_EXCL_VAT . '</span>' : '';
$pls_shipping_info = ( SHOW_SHIPPING_COST == 'true' ) ? '<br><span class="pls_Shippingtext" align="center">' . MODULE_STORE_SHIPPING_TITLE . '</span>' : '';
$pls_baseprice_query = "SELECT products_baseprice FROM " . TABLE_PRODUCTS . " WHERE products_status = '1' AND products_id = '" . $xsell['products_id'] . "'";
$pls_baseprice = ' <br><span class="pls_basePrice">' . $xsell['products_baseprice'] . '</span>';
// PLS Taxinfo, Shippinginfo, Baseprice ende
if (tep_not_null($xsell['specials_new_products_price'])) {
$xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br>';
$xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . $pls_baseprice . $pls_taxinfo . $pls_shipping_info . '</span>';
} else {
$xsell_price = $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . $pls_baseprice . $pls_taxinfo . $pls_shipping_info;
}
?>
<?php
if (PRODUCT_LIST_IMAGE > 0) {
echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('images/' . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
}
?>
<div class="caption">
<p class="text-center">
<?php echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a>'; ?>
</p>
<hr>
<p class="text-center">
<?php echo $xsell_price; ?>
</p>
<div class="text-center">
<div class="btn-group">
<a href="<?php echo tep_href_link('product_info.php', tep_get_all_get_params(array('action')) . 'products_id=' . $xsell['products_id']); ?>" class="btn btn-default" role="button"><?php echo SMALL_IMAGE_BUTTON_VIEW; ?></a>
<?php if (SHOW_BUTTON_BUY_NOW == 'true') {
echo '<a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=buy_now_xsell&products_id=' . (int)$xsell['products_id']) . '" class="btn btn-success btn-index btn-buy" role="button">' . IMAGE_BUTTON_BUY_NOW . '</a>';
} ?>
</div>
</div>
</div>
</div>
</div>
<?php
$position++;
} //eof while
?>
</div>
</div>
<?php
} // eof ($num_products_xsell > 0)
} // eof $_GET['products_id']
?>