Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 4 of 4
Option validation failed to add product to cart
 
sei
Member
 
Total Posts:  35
Joined:  2008-08-13
 

yeah i cant find no information regarding when this fix will be released… it wouldve been great for them to post the solution instead of just saying that it will be released without even mentioning a possible release date.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sei
Member
 
Total Posts:  35
Joined:  2008-08-13
 

my bad, after looking around i found the infos:

http://www.magentocommerce.com/roadmap/release/1.3.1

 
Magento Community Magento Community
Magento Community
Magento Community
 
GIDI
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2008-09-18
 

Magento team disparaged our community by not release a fast bug fix for this problem more than 2 weeks after 1.3.0 release, despite they already fix it:
Community Bug] Fatal php error :Call to a member function getSku() on a non-object, when adding a product with a custom option to the shopping closed
[Core Bug] Custom Option File: Upload file, does not work correctly! closed

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

fyi,

for those people who are NOT running 1.3.1 i did the following.

I downloaded 1.3.1 and check the file for changes

1. in app/design/frontend/default/yourtheme/catalog/product/view.phtml
change this

<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form">

to this

<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>

2. in app/code/core/Mage/Catalog/Model/Product/Option/Type/select.php

change this

public function prepareForCart()
    
{
        
if ($this->getIsValid()) {
            
return is_array($this->getUserValue()) ? implode(','$this->getUserValue()) : $this->getUserValue();


        
}
        
# Mage::throwException(Mage::helper('catalog')->__('Option validation failed to add product to cart'));
    
}

to this

public function prepareForCart()
    public function 
prepareForCart()
    
{
        
if ($this->getIsValid() && $this->getUserValue()) {
            
return is_array($this->getUserValue()) ? implode(','$this->getUserValue()) : $this->getUserValue();
        
else {
            
return null;
        
}

    }

and this in the same file
change this

public function getFormattedOptionValue($optionValue)
    
{
        $result 
$this->getEditableOptionValue($optionValue);
        return 
Mage::helper('core')->htmlEscape($result);
    
}

to this

public function getFormattedOptionValue($optionValue)
    
{
        
if ($this->_formattedOptionValue === null{
            $this
->_formattedOptionValue Mage::helper('core')->htmlEscape(
                
$this->getEditableOptionValue($optionValue)
            );
        
}
        
return $this->_formattedOptionValue;
    
}

    
/**
     * Return printable option value
     *
     * @param string $optionValue Prepared for cart option value
     * @return string
     */
    
public function getPrintableOptionValue($optionValue)
    
{
        
return $this->getFormattedOptionValue($optionValue);
    
}

hth
brendan

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaamiljj
Sr. Member
 
Avatar
Total Posts:  125
Joined:  2009-03-15
Kapaa
 

B00MER - thanks for a quick solution :}

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 4 of 4