Display Read Only attribute in cart
I have a site where certain items need to have a note saying "Final Sale. This item cannot be returned."
This text needs to be visible not only on the product info page, but in the shopping cart and on the invoice. I thought the easiest way to handle this would be to create a "final sale" attribute.
Using the read only attribute, the text appears in the product info, but not in the attributes list when the item is added to the cart.
Does anyone know if it's possible to display it here?
Re: Display Read Only attribute in cart
Make it normal - required - selected
Re: Display Read Only attribute in cart
Quote:
Originally Posted by
kobra
Make it normal - required - selected
I tried that and it displays on the product info page, but I am still not seeing this attribute in the shopping cart.
I think it has something to do with the commented out code on the attributes module. Line 495 of attributes.php.
PHP Code:
// Read Only - just for display purposes
if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
// $tmp_html .= '<input type="hidden" name ="id[' . $products_options_names->fields['products_options_id'] . ']"' . '" value="' . stripslashes($products_options->fields['products_options_values_name']) . ' SELECTED' . '" /> ' . $products_options->fields['products_options_values_name'];
$tmp_html .= $products_options_details . '<br />';
} else {
$zv_display_select_option ++;
}
I tried playing around with this a little, but didn't get anywhere. Anything I touch on this line seems to cause problems with the display of the remaining attributes in the shopping cart, and causes the product image to disappear.
Do you have any other suggestions?
Re: Display Read Only attribute in cart
Quote:
I think it has something to do with the commented out code on the attributes module.
File path & file name?
Re: Display Read Only attribute in cart
Quote:
Originally Posted by
kobra
File path & file name?
includes/modules/attributes.php
It's actually line 486 in the default file. My attributes module did have other modifications, but reverting back to the default did not solve my problem.
Re: Display Read Only attribute in cart
If you make it a radiobutton type, default selected, it can't be unselected and will display in the cart. It would be possible to hide the select circle with CSS so that it would appear as straight text in the info page.
Re: Display Read Only attribute in cart
I'm re-opening this thread because I'm still curious about this issue...so do the read-only attributes not show up in the cart?
Quote:
Originally Posted by
kobra
Make it normal - required - selected
^What does this mean? Make normal - required- is that still valid?
TH
Re: Display Read Only attribute in cart
NVM I figured out the required setting (I think) this however does not affect "read-only" attributes.
Quote:
Originally Posted by
gjh42
If you make it a radiobutton type, default selected, it can't be unselected and will display in the cart. It would be possible to hide the select circle with CSS so that it would appear as straight text in the info page.
^
There has to be a better work around out there then to set an attribute to radio button and hide the button? Your product info page would still prompt the user to "please select" (or whatever your TEXT_PRODUCT_OPTIONS is defined as) and this could potentially confuse the user if there really is no selection option (as in a display only)
Here's my situation, maybe someone would be able to shine some light on it?
So I want to use the attributes as a tracking system (skew number). Yeah I could use the Model: as an SKU system but when I have more than one option for a product (ex. quantity) I have different SKUs for the different product options. I want to "pass" the SKUs on to my fulfillment company so I need the attribute to show up in the order (and in the order email). So as of what I know so far the "Read-Only" name option is out. The radio button-> default set is a decent work-around for single products, but I would imagine someone would be able to figure out a more optimal way? I have started looking at the tpl_modules_attributes.php file but I need to dig a little deeper it seems...looks like I should be going after the $zv_display_select_option variable or $options variable...does anyone know where to find these?
Any suggestions Anyone?
Re: Display Read Only attribute in cart
Quote:
Originally Posted by
tthenne
looks like I should be going after the $zv_display_select_option variable or $options variable...does anyone know where to find these?
I found them...attributes.php in module directory
At least that's not a big file....:shocking:
Re: Display Read Only attribute in cart
So I'm in my tpl_shopping_cart_default.php and I want to display the "read-only" attributes which up until now I have not got them to display.
Okay some of you big php gurus out there...walk me through this chunk of code so I can take a look at the attributes.php next
tpl_shopping_cart_default.php line: 89
Code:
<?php
echo $product['attributeHiddenField'];
if (isset($product['attributes']) && is_array($product['attributes'])) {
echo '<div class="cartAttribsList">';
echo '<ul>';
reset($product['attributes']);
foreach ($product['attributes'] as $option => $value) {
?>
<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>
<?php
}
echo '</ul>';
echo '</div>';
}
?>
So I am understanding...the $product valuable is a big array, and the $product['attributeHiddenField'] looks like it is our product id (going to be sent on in the form), and then we have our conditional...if the attributes field is set and $products['attributes'] is an array echo our divs. Then we reset the $products['attributes'] so we're going to the first value of the $products['attributes'] array and we are setting our keys to $value array. Then we are echoing out the product_options_name (ex. quantity) and then we have our divider and then and then a br / and our products_options_values_name (ex. 100 count)
So the question arises...why wouldn't it echo out a "read-only" product attribute???