Author Topic: Price List of available shipments in product page.  (Read 355 times)

cygan89

  • Beginner
  • *
  • Posts: 8
  • A beginner
  • Skype Name: ccyinterfaces
Price List of available shipments in product page.
« on: June 27, 2018, 12:03:30 pm »
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:
Code: [Select]

$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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1665
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Price List of available shipments in product page.
« Reply #1 on: June 27, 2018, 13:25:07 pm »
You have to calculate the price with currency, look at prices.php to get some ideas.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

cygan89

  • Beginner
  • *
  • Posts: 8
  • A beginner
  • Skype Name: ccyinterfaces
Re: Price List of available shipments in product page.
« Reply #2 on: June 27, 2018, 13:59:26 pm »
Thanks for reply!

i think i should use function:
Code: [Select]
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1665
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Price List of available shipments in product page.
« Reply #3 on: June 27, 2018, 14:47:42 pm »
Try this:

$currency = $viewData['currency'];

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

cygan89

  • Beginner
  • *
  • Posts: 8
  • A beginner
  • Skype Name: ccyinterfaces
Re: Price List of available shipments in product page.
« Reply #4 on: June 27, 2018, 15:04:38 pm »
i have this error
Code: [Select]
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1665
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Price List of available shipments in product page.
« Reply #5 on: June 27, 2018, 21:26:02 pm »
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.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

cygan89

  • Beginner
  • *
  • Posts: 8
  • A beginner
  • Skype Name: ccyinterfaces
Re: Price List of available shipments in product page.
« Reply #6 on: June 29, 2018, 15:21:35 pm »
Thanks for trying help but i still can't do it...  ???

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3331
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Price List of available shipments in product page.
« Reply #7 on: June 30, 2018, 01:32:36 am »
include
Code: [Select]
if (!class_exists ('CurrencyDisplay')) {
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
}
$currency = CurrencyDisplay::getInstance();
And after use it with
Code: [Select]
$currency->priceDisplay($YOURPRICE);

cygan89

  • Beginner
  • *
  • Posts: 8
  • A beginner
  • Skype Name: ccyinterfaces
Re: Price List of available shipments in product page.
« Reply #8 on: July 02, 2018, 07:50:05 am »
Thanks! WORKING !!! :)