News:

Looking for documentation? Take a look on our wiki

Main Menu

Show specific text depending on custom_price value and more..

Started by Genius WebDesign, June 12, 2012, 19:40:08 PM

Previous topic - Next topic

Genius WebDesign

EDIT!   This issue is solved - see: http://forum.virtuemart.net/index.php?topic=104194.msg346615#msg346615
Hi,

I'm creating a webshop where the products are mostly planks of wood. I have made all the needed "custom field cart-variants" and applied them to the products. This is working great but I'm also trying to accomplish these two simple things..

1. I want to show the text "price per meter incl. VAT" just above the salesprice when the customer has not yet chosen a length variant, and "price per unit incl. VAT" when the customer has chosen a variant.
2. I want to show a popup message saying "You need to choose a length available before you add the product to the cart" if a customer tries to add to the card before chosing a variant.

Regarding #1, I have tried adding the following code in default.php of my template's "product details" folder:

<?php
               
               if ($this->product->product_unit == 1){      ?>   
               <?php echo ('<div class="x"><strong>Price per. meter (Incl. VAT)</strong></div>'); ?>
               <?php   }
               
               else if ($this->product->product_unit == 1 && $this->product->customfields > 0){    ?>   
               <?php echo ('<div class="xx"><strong>Price per. unit (Incl. VAT)</strong></div>'); ?>
               <?php   }
            
                                else       {      ?>   
               <?php echo ('<div class="xxx"><strong>Price per. unit (Incl. VAT)</strong></div>'); ?>
               <?php }
               
              ?>      

I feel that I'm very close, but of course this doesnt work because "$this->product->customfields" is not pointing to the value output of the cart variant..
If only I knew how to point to the cart variant's value and change the code accordingly this could maybe work??


Regarding #2, I simply don't know how to use the custom fields in order to make specific cart variants "required". I see that others are struggling with this aswell, http://forum.virtuemart.net/index.php?topic=100172.0


I hope that some of you super awesome php-nerds can help me out here..

Brgds