Virtuemart 2.0.6 - required product variants and more..

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
fabelmik
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Mon Feb 06, 2012 12:39 pm

Virtuemart 2.0.6 - required product variants and more..

Post by fabelmik » Fri Jun 15, 2012 11:06 am

Hi,

I'm creating a webshop using Virtuemart 2.0.6. I have some problems and i have tried the Virtuemart forum but havent had any replies yet, so I thought I would try this option..

The products in my shop are mostly planks of wood so I need certain value dependant information to show on the product page. 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

Locked

Return to “Extensions for Joomla! 2.5”