News:

Support the VirtueMart project and become a member

Main Menu

$data->billTotal

Started by marvays, November 13, 2018, 12:47:17 PM

Previous topic - Next topic

marvays

Hi. I try make code module for VM3. In VM2 I used <?php if ($data->billTotal == 0) { ?> Can I use this in VM3? Because, this not work :( I think, VM not use billTotal, but another one.

AH

where are you expecting to use this variable

Looks like prepareAjaxData in components\com_virtuemart\helpers\cart.php

More information may help you get an useful answer.

Regards
A

Joomla 4.4.5
php 8.1

marvays

Quote from: AH on November 13, 2018, 13:26:05 PM
where are you expecting to use this variable

Looks like prepareAjaxData in components\com_virtuemart\helpers\cart.php

More information may help you get an useful answer.

in product detail Page . . . http://www.lukysipy.cz.hyperion.blueboard.cz/eshop/lazecky-pioneer-nature-dlouhy-luk-68

AH

billtotal in product details??

this is a cart variable
Regards
A

Joomla 4.4.5
php 8.1

marvays

Yes. But in product detail i want make div with:

<div class="motivator" style="padding: 10px;color: #f15259;text-align: center;text-transform: none;">
<?php if ($data->billTotal == 0) { ?>
            <span style="animation: blinker 2s linear infinite;">When ordering over 100, - is shipping free!</span>
<?php } elseif ($data->billTotal 5000) { ?>
            <span style="animation: blinker 2s linear infinite;">Do you want to transport for free? Add more products for: <?php echo (5000 - ($data->billTotal)) ?>,-</span>
<?php } else { ?>
            <span style="font-weight: 700; color: #109d16;">Your order will be shipped free of charge!</span>
<?php ?>
</div>



And for it i need know price of all product in cart.

GJC Web Design

then u need to load the $cart object or get it from the session etc
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

marvays


PRO

or setup a cart module, then do your own override for it

then you have to load it in your details page where you want it


public static function mod_by_position($position){
jimport('joomla.application.module.helper');
$modules = JModuleHelper::getModules($position);
$html='';
foreach ($modules as $module) {
$html.=JModuleHelper::renderModule($module);
}
return $html;
}

echo mod_by_position('my-position');

marvays

Hm, I am not understand. Php are not for me :(

We must reload bak. I have code to cart module, who work on version 2.
live here: https://www.lukysipy.cz
When I put in a basket, the module changes the text


<div class="motivator">
<?php if ($data->billTotal == 0) { ?>
            <span style="animation: blinker 2s linear infinite;">Při objednávce nad 5000,- je doprava zdarma!</span>
<?php } elseif ($data->billTotal 5000) { ?>
            <span style="animation: blinker 2s linear infinite;">Chcete dopravu zdarma? Přidejte ještě zboží za: <?php echo (5000 - ($data->billTotal)) ?>,-</span>
<?php } else { ?>
            <span style="font-weight: 700; color: #109d16;">Vaše objednávka bude dopravena zdarma!</span>
<?php ?>
</div>


When I use this on J3.9 and VM 3.4.2 cat show me first testy variant. And when I add produst to cart, text not change. where I have problem?
Test page here: http://www.lukysipy.cz.hyperion.blueboard.cz

Milbo


$cart = VirtueMartCart::getCart();
vmdebug('Lets see the cart object',$cart);


Just enable the vmdebug to see now the whole cart and how the information is stored
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/