Display Per Product Shipping Cost on Product page
12 years 5 months ago #151069
by jazzmang
Display Per Product Shipping Cost on Product page was created by jazzmang
-- HikaShop version -- : 2.3.0
-- Joomla version -- : 3.2
-- PHP version -- : 5.4.26
Using manual shipping with per product shipping turned on.
I'd like to display, if set, the per product price and/or fee value on the actual product page itself.
I don't see any option to do this but may be I missed something.
I've searched around and as far as I can tell this may not be possible because shipping cannot be calculated until an address has been set (e.g. in checkout or if logged in). Right now the best I can come up with is enter that as part of the product description.
I didn't see how a custom field would work either. I tried custom text but couldn't get it to so I could do it per product. Also I dislike the idea of double entry. I'd much rather echo out the first order price/fee values if set.
Far as I can tell this may only be possible with a custom view.
-- Joomla version -- : 3.2
-- PHP version -- : 5.4.26
Using manual shipping with per product shipping turned on.
I'd like to display, if set, the per product price and/or fee value on the actual product page itself.
I don't see any option to do this but may be I missed something.
I've searched around and as far as I can tell this may not be possible because shipping cannot be calculated until an address has been set (e.g. in checkout or if logged in). Right now the best I can come up with is enter that as part of the product description.
I didn't see how a custom field would work either. I tried custom text but couldn't get it to so I could do it per product. Also I dislike the idea of double entry. I'd much rather echo out the first order price/fee values if set.
Far as I can tell this may only be possible with a custom view.
Please Log in or Create an account to join the conversation.
12 years 5 months ago #151168
by Xavier
Replied by Xavier on topic Display Per Product Shipping Cost on Product page
Hi,
This is actually not possible by default, you will have to add some custom code to display this value.
Code like:
This is actually not possible by default, you will have to add some custom code to display this value.
Code like:
Code:
<?php
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM '.hikashop_table('shipping_price').' WHERE shipping_price_ref_id = '.(int)$this->element->product_id);
$shippingPrices = $db->loadObjectList();
$currencyHelper = hikashop_get('helper.currency');
$mainCurr = $currencyHelper->mainCurrency();
$app = JFactory::getApplication();
$currCurrency = $app->getUserState( HIKASHOP_COMPONENT.'.currency_id', $mainCurr );
foreach($shippingPrices as $shippingPrice){
$priveValue = (float)$shippingPrice->shipping_price_value + (float)$shippingPrice->shipping_fee_value;
echo $currencyHelper->format($priveValue,$currCurrency);
}
?>
Please Log in or Create an account to join the conversation.
Time to create page: 0.141 seconds