VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Topic started by: MikeUK on April 16, 2008, 18:35:11 pm

Title: Trouble modifying basket template
Post by: MikeUK on April 16, 2008, 18:35:11 pm
Hi all

Joomla 1.15
VM 1.015
lightbox mod (Mark Calif)

I have just finished changing the product flypage to recognise products that need to be sold by weight, and those that don't.

I've modified the shop.product_details.php and ps_product_attributes.php using two methods, to show quantity and price differently. I made it work up till now using both methods below. Please note that I'm not a php coder so the code could well be dodgy, but works so far. I'm just figuring it out as I go based on old, outdated programming experience.

1) in shop.product_details simply using: if ($flypage == flypage_byweight)  (and, of course, the category flypage for these categories is set to shop.flypage_byweight

2) in ps_product_attribute using the following code: if ($product_weight > 1 and $product_weight_uom == 'grams')   with these lines before:
             $product_weight_uom = $ps_product->get_field( $product_id, "product_weight_uom");
      $product_weight = round($ps_product->get_field( $product_id, "product_weight"));   

Neither of the above methods work in basket_b2c.html.php, as far as I can tell. I understand this file has a different purpose, but I want to have a condition that will display the quantity as is, or multiplied by 100, and also to change the display to add the word 'grams' or not.

In natural langugae, something like....... if (product_unit = grams) then display the quantity entered multiplied by 100 and add the word 'grams'. If not, just display the entered quantity.

If anyone can help with this it would be really appreciated.

Here are two jpgs of the modified flypages for products sold by weight using two different methods (quantity entered as grams, or entered as hundreds of grams).

[attachment cleanup by admin]
Title: Re: Trouble modifying basket template
Post by: MikeUK on April 17, 2008, 12:09:57 pm
ok, so more research suggest to me that I can't put any conditinals in the template files.

Alternatively, could anyone tell me how I could set up a conditional that would call 1 of, say, 3 basket templates. Then I could simply create 3 different ones and do it that way.

The other thing I am not quite sure about is how to carry a variable value into the basket template.

Sorry if these questions are a bit simplistic. I'm a bit of a hack with all this.