News:

Looking for documentation? Take a look on our wiki

Main Menu

CartVariant custom fields price display

Started by Clocked0ne, January 27, 2012, 11:54:26 AM

Previous topic - Next topic

Clocked0ne

Hi guys,

How can I have the price be replaced rather than the variant price adding onto the base price? Is this possible?

If not, how can I have the additional price of the variant displayed as - £x.xx extra or similar instead of the default - £x.xx

At the moment it does not make sense for my product when trying to choose a different size that costs slightly more, the smallest size is not 'FREE', there is just no additional charge over base price! (see images)

[attachment cleanup by admin]

Clocked0ne

No one has any advice here? I thought this would be an easy one to answer.

Clocked0ne

I'm really at a loss that no one has attempted to answer this yet, surely I am not the only one that thinks the lack of flexibility in how cartVariants are displayed (and indeed the default method) is stupid..?

merdan2005

delete the default value "0" in the back-end. This will change the the "free"' to nothing.

For your first question see: http://forum.virtuemart.net/index.php?topic=96591.0

Clocked0ne

Hi merdan2005, thanks for the reply.

I have tried the removal and found that it didn't look right still, so instead I simply edited the php file  to remove the prices being shown on variants, now only the main price adjusts. It's not ideal, but its better - the link you posted was for a tax based issue, not directly related, but thanks :)

PRO

<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>

^^ will add a + to the dollar value.

THEN: do a language override for the text
http://forum.virtuemart.net/index.php?topic=93360.msg306906#msg306906

Clocked0ne

Thank you, is that line to add the + still in the administrator/components/com_virtuemart/models/customfields.php file?

PRO

Quote from: Clocked0ne on March 05, 2012, 18:30:49 PM
Thank you, is that line to add the + still in the administrator/components/com_virtuemart/models/customfields.php file?

No, thats the views/productdetails/tmpl/default.php

There is no reason to change the administrator files for something so small.

Do a layouts override, and the changes will not get overwritten when you update

Zuske

i also want to add the + in front of the extra price display, because it makes sense.

so i put this code
<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>
into views/productdetails/tmpl/default.php
but the page went blank
so where exactly do i place this code on which line, and do since i use the euro do i have the change the symbol?

PRO

Quote from: Zuske on March 09, 2012, 01:56:06 AM
i also want to add the + in front of the extra price display, because it makes sense.

so i put this code
<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>
into views/productdetails/tmpl/default.php
but the page went blank
so where exactly do i place this code on which line, and do since i use the euro do i have the change the symbol?

in the add to cart form, you will see the cart attributes.

REPLACE this     <?php echo $field->display ?>

with this
<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>