Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - PureMart (SKU# FLEX-00010)

TOPIC: Error with createPriceDiv() default_pricelist.php

Error with createPriceDiv() default_pricelist.php 11 years 2 months ago #2612

Hi, my site is babynose.com.au. I am using PHP 5.3.19, Joomla 2.5.9, VirtueMart 2.0.18a and PureMart 3.4.

Everything with the products and cart was working fine until today. Now whenever I select the shipping method and press "save" I get...

Warning: Invalid argument supplied for foreach() in templates/TEMPLATENAME/html/com_virtuemart/cart/default_pricelist.php on line 126

Fatal error: Call to a member function createPriceDiv() on a non-object in templates/TEMPLATENAME/html/com_virtuemart/cart/default_pricelist.php on line 286

This may be related to me changing the Product -> Custom Field "Weight" -> Cart Attribute from No to Yes.

You should be able to reproduce the problem just by adding any product to the cart and then in the cart add an address with a valid Australian postcode like 5000 for South Australia.

This is how to reproduce the error:
1. Go to babynose.com.au
2. Click on "Nasal Aspirator Shop" (which is a "Flexv2ListView" instead of "Front page")
3. On any of the 5 products at the bottom click on the "add to cart" floating button.
4. Click on "Show Cart" in the pop up.
5. Click on "select shipment" to get the message about the need to set an address.
6. Click on "Save"
7. BOOM!!

This is a short way of getting the error.. If you have a valid billing address it does the same thing.

Any ideas?

Regards,
Mr BabyNose
Last Edit: 11 years 2 months ago by Mr BabyNose. Reason: Added step by step to reproduce the error
The administrator has disabled public write access.

Error with createPriceDiv() default_pricelist.php 11 years 2 months ago #2613

I have just made a lot of changes and managed to make the error go away, but also lost some functionality that I wanted.
I'll add the changes back 1 at a time to see if it breaks again.
Regards,
Mr BabyNose
The administrator has disabled public write access.

Error with createPriceDiv() default_pricelist.php 11 years 2 months ago #2645

Hi,

The line that generates problem (line 126th)
are not included by the default Virtuemart. We have put them there, just to hide "address field" if the user hasn't logged in or hasn't provided any address yet. Just to eliminate the unnecessary elements for simplification purposes.

You can eliminate this check, therefore the line 126th won't generate any more problem to you.
OKAY, retrieve your changes in this PHP file:

templates/TEMPLATENAME/html/com_virtuemart/cart/default_pricelist.php

Take the original php file that comes with our VM Template, but instead of replace it with yours (cause i am seeing you have made some modifications on it.)

With the original PHP,
Look at the 124th line and find these lines:
<?php 
@$checkIfEmpty == "deneme";
foreach($this->cart->BTaddress['fields'] as $item){	
@$checkIfEmpty .= $this->escape($item['value']);
}
if ($checkIfEmpty == "") {	?>
 
<? } else { ?>

Remove them.
Now look at the 255th lline;
Find this line:
</div>
<?php } ?>
<div id="checkoutbar" class="active"><?php echo JText::_('COM_VIRTUEMART_ORDER_INFO'); ?></div>
 
<div class="checkout-content-cart"> 

and change it with this:
</div>
 
<div id="checkoutbar" class="active"><?php echo JText::_('COM_VIRTUEMART_ORDER_INFO'); ?></div>
 
<div class="checkout-content-cart"> 

(basically delete only <?php } ?> )


Okay, now you should see the 1st error anymore.
About the second error message,
I am not quite sure what might cause an error with that, because that line is also same in original Virtuemart as well. It is not something that we have implemented, but try this:

Find this Line:
echo $this->currencyDisplay->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->cart->pricesUnformatted[$pkey],false,false,$prow->quantity) ?>
 
                <?php 

And replace it with this:
echo $this->currencyDisplay->createPriceDiv ('salesPrice', '', $this->cart->pricesUnformatted[$pkey], FALSE, FALSE, $prow->quantity);

(while replacing, make sure what you are deleting and what you are adding instead. Select exactly the same line as i mentioned here, and paste exactly what i am telling you here.)

If this doesn't solve the problems let me know. (i am sure the 1error will be gone but i still can't be sure about the 2nd. I might be related to Virtuemart itself, in that case i will have nothing to do with it...)

Regards.
Forum Support.
Last Edit: 11 years 2 months ago by Support.
The administrator has disabled public write access.

Error with createPriceDiv() default_pricelist.php 11 years 2 months ago #2662

Hi,

I am curious why you said "cause i am seeing you have made some modifications on it.)". I just checked and the templates/TEMPLATENAME/html/com_virtuemart/cart/default_pricelist.php file is still exactly as I downloaded from you on 20 February. (dated 8 February 2013). This may be linked to what I have mentioned in this post. below

www.flexiblewebdesign.com/index.php?option=com_kunena&view=topic&catid=18&id=641&Itemid=234

It appears the latest version of PureMart 3.4 may contain some files that are different to what you think.

Anyway I have not had the problem with the original 2 errors since I made all the changes to make them go away. I'll slowly put back the changes and see if the problems occur again.

I made the changes exactly as you mentioned in your post and everything still works fine without those errors.

Regards,
Mr BabyNose
The administrator has disabled public write access.

Error with createPriceDiv() default_pricelist.php 11 years 2 months ago #2694

Then i was wrong by saying ""cause i am seeing you have made some modifications on it.)"
'cause once i looked at your website, i though you did some changes in PHP files. I didn't look deeply though. Maybe you did those changes by only CSS. It is a possibility.

As you know i can't see what's inside the PHP by just browsing the website. I just did guess.
From v2.0 to v3.4
nothing has changed in shopping cart.
Anyway.. since everything is okay now without errors. everything is fine.

This case is solved. Topic is closed.

Regards,
Forum Support.
The administrator has disabled public write access.
Time to create page: 0.189 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo