News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Price List of available shipments in product page.

Started by cygan89, June 27, 2018, 12:03:30 PM

Previous topic - Next topic

cygan89

Hello, i dont find answer in other post's.
VM: 3.2.14
J: 3.6.5
demo link: http://test.ccy.pl/en/sklep/wszystkie-produkty/interfejsy-lpg/adapter-for-stefanelli-sis-plus-detail

I prepared list of shipments ways with pirces gemerated from published shipments:


but when i change currency prices of shipment not calculating



my code:


$methods = VmModel::getModel('Shipmentmethod') -> getShipments();
foreach ($methods as $item) {
if ($item -> published == 1) {
$shipment_parms = $item -> shipment_params;
$just_price = explode('|', $shipment_parms);
$float_price = round(preg_replace('/[^0-9.]/', '', $just_price[14]) * 1.23, 2);
if ($float_price < 40)
echo '<span>' . $item -> shipment_name . '</span>' . '<span style="float:right">' . number_format($float_price, 2) . ' ' . $displayCurrency -> currency_symbol . '</span>
<br> ';
}


please help

Jörgen

You have to calculate the price with currency, look at prices.php to get some ideas.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cygan89

Thanks for reply!

i think i should use function:
public function createPriceDiv($name,$description,$product_price,$priceOnly=false,$switchSequel=false,$quantity = 1.0,$forceNoLabel=false, $force = false)

sorry but im java programmer and i dont know syntax of php, if you can please tell me how to use method from  currencydisplay.php file in
/components/com_virtuemart/sublayouts/addtocart.php file


Jörgen

Try this:

$currency = $viewData['currency'];

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cygan89

i have this error
Fatal error: Call to a member function createPriceDiv() on a non-object in /home/scalp/public_html/test/components/com_virtuemart/sublayouts/addtocart.php on line 68

Jörgen

OK the viewdata don´t include the currency, then add this to the call of the sublayout. Check the call to prices.php sublayout and do the same.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cygan89

Thanks for trying help but i still can't do it...  ???

Studio 42

include
if (!class_exists ('CurrencyDisplay')) {
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
}
$currency = CurrencyDisplay::getInstance();

And after use it with
$currency->priceDisplay($YOURPRICE);

cygan89