guys,
Can I show related product under check out page? and how?
Misael Broertjes
If you look at the related products code in the view template default_relatedproducts.php then you will see that it relates purely to the product details page, so could not be used for the checkout without a lot of additional coding to that and the chackout templates. Then decide what would happen if you have 10 products in checkout.
Simple answer - no.
step1:You have to add some lines of code to /administrator/components/com_virtuemart/html/basket.php
Step2: Fin the following code
if( $show_basket ) {
if( $auth["show_price_including_tax"] == 1) {
$basket_html = $tpl->fetch( 'basket/basket_b2c.html.php');
}
else {
$basket_html = $tpl->fetch( 'basket/basket_b2b.html.php');
}
Step3: right after that put in the following code
$dbrelated= new ps_DB;
$q = "SELECT product_sku, related_products FROM #__{vm}_product,#__{vm}_product_relations ";
$id_de_producto = $cart[0]["product_id"];
$q .= "WHERE #__{vm}_product_relations.product_id='$id_de_producto' AND product_publish='Y' ";
$q .= "AND FIND_IN_SET(#__{vm}_product.product_id, REPLACE(related_products, '|', ',' )) LIMIT 0, 4";
$dbrelated->query( $q );
if( $dbrelated->num_rows() > 0 ) {
$tpl->set( 'ps_product', $ps_product );
$tpl->set( 'products', $dbrelated );
$basket_html .= $tpl->fetch( '/common/relatedProducts.tpl.php' );
}
And your one. However, The problem is that when the cart has more than 1 product, you have to decide which related products of which of the items you want to show.
I hope this helped