X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Is there a way to get a specific attribute value? (https://forum.x-cart.com/showthread.php?t=72501)

GlasPak 07-29-2015 06:29 AM

Is there a way to get a specific attribute value?
 
So I want to grab an attribute I created "Pieces Per Case" and add it to

default/en/common/price_parts/price.tpl

How do I specifically get the value of the attribute to modify

Code:

<li><span class="price product-price">{formatPrice(getListPrice(),null,1):h}</span><span> per case</span></li>

I would like the end result to be

<li><span class="price product-price">{formatPrice(getListPrice(),null,1):h}</span><span> per case (##AttributeValue## Pieces Per Case</span></li>

Edit: It looks like the attribute is

<select class="form-control" name="attribute_values[50]" data-attribute-id="50">
<option selected="selected" value="371">12</option>
<option value="372">36 (+$42.00)</option>
<option value="540">100 (+$125.00)</option>
</select>

Also I really wish i could change the +$42.00 and +125.00 to just be the price of those values... if default is $30.00 which it just said 36 ($72.00) and 100 ($150.00)... A lot of customers have said the + is confusing.

qualiteam 07-30-2015 10:13 AM

Re: Is there a way to get a specific attribute value?
 
You should look into creating a custom module that will decorate \XLite\View\Product\AttributeValue\Customer\Select ::getModifierTitle() method and change the way how it displays the modifier surcharge.

Another method that you may to customize is \XLite\Model\AttributeValue\AttributeValueSelect:: formatModifier().

GlasPak 08-05-2015 04:14 AM

Re: Is there a way to get a specific attribute value?
 
Quote:

Originally Posted by qualiteam
You should look into creating a custom module that will decorate \XLite\View\Product\AttributeValue\Customer\Select ::getModifierTitle() method and change the way how it displays the modifier surcharge.

Another method that you may to customize is \XLite\Model\AttributeValue\AttributeValueSelect:: formatModifier().


I couldn't find AttributeValueSelect when I looked for it.

qualiteam 08-08-2015 02:15 AM

Re: Is there a way to get a specific attribute value?
 
Quote:

Originally Posted by GlasPak
I couldn't find AttributeValueSelect when I looked for it.


It is in the [XC5]/classes/XLite/Model/AttributeValue/AttributeValueSelect.php file.

But you should not edit the file directly. Instead create a custom module that decorates the methods of the class that you want to change.
Please refer to the documentation for developers at http://kb.x-cart.com/


All times are GMT -8. The time now is 01:18 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.