VirtueMart Dev/Coding Central: VM1 (old version) > Development Projects, Modifications, Hacks & Tweaks. VM1.1
Display Child Products with prices
(1/1)
Panikos:
Hack to display child products with prices at top of product page VM 1.1.2
flypage.tpl.php
add under the first table row which displays the product price
--- Code: --- <!-- Displays Top Product Attributes -->
<?php if($attributeexists = 'Y') { ?>
<tr>
<td width="100%"><?php echo $attributes ?></td>
</tr>
<?php } ?>
--- End code ---
ps_product.php
add to the bottom
--- Code: --- function show_price_attributes( $product_id, $hide_tax = false ) {
global $VM_LANG, $CURRENCY_DISPLAY,$vendor_mail;
$auth = $_SESSION['auth'];
$tpl = new $GLOBALS['VM_THEMECLASS']();
$product_name = htmlentities( $this->get_field($product_id, 'product_name'), ENT_QUOTES );
if( $auth['show_prices'] ) {
// Get the DISCOUNT AMOUNT
$discount_info = $this->get_discount( $product_id );
// If it isn't a percentage discount and there is a discount amount
if( !$discount_info["is_percent"] && $discount_info["amount"] != 0 ) {
$discount_info["amount"] = $GLOBALS['CURRENCY']->convert($discount_info["amount"]);
}
// Get the Price according to the quantity in the Cart
$price_info = $this->get_price( $product_id );
$tpl->set( 'price_info', $price_info );
// Get the Base Price of the Product
$base_price_info = $this->get_price($product_id, true );
$tpl->set( 'base_price_info', $base_price_info );
$prods_array = array() ;
$prods_array['prod_discount'] = $discount_info["amount"] ;
$prods_array['prod_base'] = $base_price_info ;
}
return $prods_array ;
}
--- End code ---
shop_product_details.php
somewhere before the $tpl-> begin
--- Code: ---/**
* Product Attributes Extra
* this displays product attributes at the top of product page
**/
$attribute_publish = $ps_product_attributes_extra->attributePublish( $product_id ) ;
$attributeexists = $ps_product_attributes_extra->attributeAttributeExist( $product_id ) ;
$attribute_prices = $ps_product->show_price_attributes( $product_id ) ;
$attributes = $ps_product_attributes_extra->attributeExtra($product_id, $attribute_prices) ;
--- End code ---
shop_product_details.php
at the bottom above finish and print out the page
--- Code: ---$tpl->set( "attributes", $attributes) ; // Extra Product Attributes
$tpl->set( "attribute_publish", $attribute_publish) ; // PublishProduct Attributes
$tpl->set( "attributeexists", $attributeexists) ; // Extra Product Attributes Exist Y/N
--- End code ---
Then put the attached file in administrator classes.
This hack uses the existing child product info. It will only display if child product info exist. If the info is price dependant it will display the price (currency dependant).
This is based on VM 1.1.2
Navigation
[0] Message Index
Go to full version