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

Please specify the product required option(s) error when trying to add to cart
 
knighs2
Jr. Member
 
Total Posts:  25
Joined:  2007-12-08
 

The below worked for me, However id like to know how this error happened. Im on 1.3.1.1 i didnt change a thing and i have a 2nd site and nothing has been change files wise or admin wise for a week yet it has the same error ? Ive gone from a working site to an odd error.

metalMilita - 23 April 2009 12:08 AM

JHubb - 22 April 2009 05:14 AM
I’ve found a fix that works, but USE WITH CAUTION AND BACK UP YOUR FILES!!!

Also, since I have changed core files, they will be overwritten with the next update so
hopefully it will have been fixed by then.

in app/code/core/Mage/Catalog/Block/Product/List.php

change

public function getAddToCartUrl($product, $additional = array())
{
if ($product->hasRequiredOptions()) {
$url = $product->getProductUrl();
$link = (strpos($url, ‘?’) !== false) ? ‘&’ : ‘?’;
return $url . $link . ‘options=cart’;
}
return parent::getAddToCartUrl($product, $additional);
}

to

public function getAddToCartUrl($product, $additional = array())
{
if ($product->hasOptions()) {
$url = $product->getProductUrl();
$link = (strpos($url, ‘?’) !== false) ? ‘&’ : ‘?’;
return $url . $link . ‘options=cart’;
}
return parent::getAddToCartUrl($product, $additional);
}

Please note, I won’t be held responsible if you mess your store up!!! smile

Hopefully that will work for everyone else too!

Hey! thanks for suggestion.But it didnt work exactly.Yes it solved ‘please specify product links’ warning but now I am getting ‘please specify product links’ warning.
I think i have to wait for 1.3.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
envisionweb
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-11-16
Orlando, FL
 

Finally I have the same error when some products after clicking “add to cart” with the error “please specify product option(s) and the resulting product is not added.

So I upgraded to latest version an hour ago thinking it would fix it. 1.3.2.1, and to no avail. Still it does not work.  My cart is now rendered inoperative and I am out of business at the moment.

Does anyone have any ideas? The one simple fix mentioned and quoted over and over here of dropping “Required” from a string in List.php does not work. In fact, in new latest cart version that line of code no longer exists.

 
Magento Community Magento Community
Magento Community
Magento Community
 
envisionwebgroup
Member
 
Avatar
Total Posts:  37
Joined:  2008-12-11
Orlando, FL
 

Has this issue been fixed for ANYONE in the 1.3.2.1 update?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alfagolf
Jr. Member
 
Total Posts:  18
Joined:  2009-04-05
 

Hi,

“Veuillez spécifier la (les) option(s) obligatoire(s) de produit”
Please specify the product required option(s) error when trying to add to cart

in app/code/core/Mage/Catalog/Block/Product/List.php
change
public function getAddToCartUrl($product, $additional = array())
{
if ($product->hasRequiredOptions()) {
$url = $product->getProductUrl();
$link = (strpos($url, ‘?’) !== false) ? ‘&’ : ‘?’;
return $url . $link . ‘options=cart’;
}
return parent::getAddToCartUrl($product, $additional);
}

to

public function getAddToCartUrl($product, $additional = array())
{
if ($product->hasOptions()) {
$url = $product->getProductUrl();
$link = (strpos($url, ‘?’) !== false) ? ‘&’ : ‘?’;
return $url . $link . ‘options=cart’;
}
return parent::getAddToCartUrl($product, $additional);
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
envisionweb
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-11-16
Orlando, FL
 

Hi Lakanat,

Why are you posting the same non-working “fix” that so many of us have confirmed does NOT work?  Furthermore, do you realize that those lines no longer exist in the latest upgrade in the file:

app/code/core/Mage/Catalog/Block/Product/List.php

Am I missing something here????

So here is the code in app/code/core/Mage/Catalog/Block/Product/List.php and I dont see the code above in that file.  I have previously posted that fact.

class Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_Abstract
{
    
/**
     * Default toolbar block name
     *
     * @var string
     */
    
protected $_defaultToolbarBlock 'catalog/product_list_toolbar';

    
/**
     * Product Collection
     *
     * @var Mage_Eav_Model_Entity_Collection_Abstract
     */
    
protected $_productCollection;

    
/**
     * Default product amount per row in grid display mode
     *
     * @var int
     */
    
protected $_defaultColumnCount 3;

    
/**
     * Product amount per row in grid display mode depending
     * on custom page layout of category
     *
     * @var array
     */
    
protected $_columnCountLayoutDepend = array();


    
/**
     * Retrieve loaded category collection
     *
     * @return Mage_Eav_Model_Entity_Collection_Abstract
     */
    
protected function _getProductCollection()
    
{
        
if (is_null($this->_productCollection)) {
            $layer 
Mage::getSingleton('catalog/layer');
            
/* @var $layer Mage_Catalog_Model_Layer */
            
if ($this->getShowRootCategory()) {
                $this
->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
            
}

            
// if this is a product view page
            
if (Mage::registry('product')) {
                
// get collection of categories this product is associated with
                
$categories Mage::registry('product')->getCategoryCollection()
                    ->
setPage(11)
                    ->
load();
                
// if the product is associated with any category
                
if ($categories->count()) {
                    
// show products from this category
                    
$this->setCategoryId(current($categories->getIterator()));
                
}
            }

            $origCategory 
null;
            if (
$this->getCategoryId()) {
                $category 
Mage::getModel('catalog/category')->load($this->getCategoryId());
                if (
$category->getId()) {
                    $origCategory 
$layer->getCurrentCategory();
                    
$layer->setCurrentCategory($category);
                
}
            }
            $this
->_productCollection $layer->getProductCollection();

            
$this->prepareSortableFieldsByCategory($layer->getCurrentCategory());

            if (
$origCategory{
                $layer
->setCurrentCategory($origCategory);
            
}
        }
        
return $this->_productCollection;
    
}

    
/**
     * Retrieve loaded category collection
     *
     * @return Mage_Eav_Model_Entity_Collection_Abstract
     */
    
public function getLoadedProductCollection()
    
{
        
return $this->_getProductCollection();
    
}

    
/**
     * Retrieve current view mode
     *
     * @return string
     */
    
public function getMode()
    
{
        
return $this->getChild('toolbar')->getCurrentMode();
    
}

    
/**
     * Need use as _prepareLayout - but problem in declaring collection from
     * another block (was problem with search result)
     */
    
protected function _beforeToHtml()
    
{
        
/*$toolbar = $this->getLayout()->createBlock('catalog/product_list_toolbar', microtime());
        if ($toolbarTemplate = $this->getToolbarTemplate()) {
            $toolbar->setTemplate($toolbarTemplate);
        }*/
        
$toolbar $this->getToolbarBlock();

        
// called prepare sortable parameters
        
$collection $this->_getProductCollection();

        
// use sortable parameters
        
if ($orders $this->getAvailableOrders()) {
            $toolbar
->setAvailableOrders($orders);
        
}
        
if ($sort $this->getSortBy()) {
            $toolbar
->setDefaultOrder($sort);
        
}
        
if ($modes $this->getModes()) {
            $toolbar
->setModes($modes);
        
}

        
// set collection to tollbar and apply sort
        
$toolbar->setCollection($collection);

        
$this->setChild('toolbar'$toolbar);
        
Mage::dispatchEvent('catalog_block_product_list_collection', array(
            
'collection'=>$this->_getProductCollection(),
        ));

        
$this->_getProductCollection()->load();
        
Mage::getModel('review/review')->appendSummary($this->_getProductCollection());
        return 
parent::_beforeToHtml();
    
}

    
/**
     * Retrieve Toolbar block
     *
     * @return Mage_Catalog_Block_Product_List_Toolbar
     */
    
public function getToolbarBlock()
    
{
        
if ($blockName $this->getToolbarBlockName()) {
            
if ($block $this->getLayout()->getBlock($blockName)) {
                
return $block;
            
}
        }
        $block 
$this->getLayout()->createBlock($this->_defaultToolbarBlockmicrotime());
        return 
$block;
    
}

    
/**
     * Retrieve list toolbar HTML
     *
     * @return string
     */
    
public function getToolbarHtml()
    
{
        
return $this->getChildHtml('toolbar');
    
}

    
public function setCollection($collection)
    
{
        $this
->_productCollection $collection;
        return 
$this;
    
}

    
public function addAttribute($code)
    
{
        $this
->_getProductCollection()->addAttributeToSelect($code);
        return 
$this;
    
}

    
public function getPriceBlockTemplate()
    
{
        
return $this->_getData('price_block_template');
    
}

    
/**
     * Retrieve Catalog Config object
     *
     * @return Mage_Catalog_Model_Config
     */
    
protected function _getConfig()
    
{
        
return Mage::getSingleton('catalog/config');
    
}

    
/**
     * Prepare Sort By fields from Category Data
     *
     * @param Mage_Catalog_Model_Category $category
     * @return Mage_Catalog_Block_Product_List
     */
    
public function prepareSortableFieldsByCategory($category{
        
if (!$this->getAvailableOrders()) {
            $this
->setAvailableOrders($category->getAvailableSortByOptions());
        
}
        $availableOrders 
$this->getAvailableOrders();
        if (!
$this->getSortBy()) {
            
if ($categorySortBy $category->getDefaultSortBy()) {
                
if (!$availableOrders{
                    $availableOrders 
$this->_getConfig()->getAttributeUsedForSortByArray();
                
}
                
if (isset($availableOrders[$categorySortBy])) {
                    $this
->setSortBy($categorySortBy);
                
}
            }
        }


        
return $this;
    
}

    
/**
     * Retrieve product amount per row in grid display mode
     *
     * @return int
     */
    
public function getColumnCount()
    
{
        
if (!$this->_getData('column_count')) {
            $pageLayout 
$this->getPageLayout();
            if (
$pageLayout && $this->getColumnCountLayoutDepend($pageLayout->getCode())) {
                $this
->setData(
                    
'column_count',
                    
$this->getColumnCountLayoutDepend($pageLayout->getCode())
                );
            
else {
                $this
->setData('column_count'$this->_defaultColumnCount);
            
}
        }

        
return (int) $this->_getData('column_count');
    
}

    
/**
     * Add row size depends on page layout
     *
     * @param string $pageLayout
     * @param int $rowSize
     * @return Mage_Catalog_Block_Product_List
     */
    
public function addColumnCountLayoutDepend($pageLayout$columnCount)
    
{
        $this
->_columnCountLayoutDepend[$pageLayout] $columnCount;
        return 
$this;
    
}

    
/**
     * Remove row size depends on page layout
     *
     * @param string $pageLayout
     * @return Mage_Catalog_Block_Product_List
     */
    
public function removeColumnCountLayoutDepend($pageLayout)
    
{
        
if (isset($this->_columnCountLayoutDepend[$pageLayout])) {
            
unset($this->_columnCountLayoutDepend[$pageLayout]);
        
}

        
return $this;
    
}

    
/**
     * Retrieve row size depends on page layout
     *
     * @param string $pageLayout
     * @return int|boolean
     */
    
public function getColumnCountLayoutDepend($pageLayout)
    
{
        
if (isset($this->_columnCountLayoutDepend[$pageLayout])) {
            
return $this->_columnCountLayoutDepend[$pageLayout];
        
}

        
return false;
    
}

    
/**
     * Retrieve current page layout
     *
     * @return Varien_Object
     */
    
public function getPageLayout()
    
{
        
return $this->helper('page/layout')->getCurrentPageLayout();
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
adonkey
Member
 
Total Posts:  67
Joined:  2008-10-28
 

bump, I have envisionweb’s problem too

Can anyone at all add a custom message that doesn’t conform EXACTLY to the custom options on the product page?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gbear
Jr. Member
 
Total Posts:  19
Joined:  2008-08-08
 

Ran into this on a 1.3.2 update.

In your custom theme, have a look at the page.xml file - will be here:
app/design/frontend/default/YOURTHEME//layout/page.xml

Doing a diff between that file & the same file in the default theme (where adding to cart works) will see a bunch of changes have been rolled in.  But around line 41 it’ll have <action method="addItem"><type>skin_js</type><name>js/effects-1.8.1.js</name></action>

This has changed to:
<action method="addJs"><script>scriptaculous/effects.js</script></action>

Making that change, uploading page.xml, clearing the cache control, solved this for us.

-Greg

QUICK EDIT:  we had modified the location of scriptaculous to the latest version, so this might not be the issue for everyone.
Since addtocarts are working in the default theme, but not in our custom theme - would wade through a file compare on the most likely culprit files in the custom theme, I was seeing a lot had been changed in the updated default theme that we don’t have in our static custom theme.  We’re changing our methods to only adding in the select files we are updating to custom themes, rather than copying all of default or modern and starting to theme.  That way unmodified templates will use default, which gets updated and will have a short set of files to compare on upgrades.  3rd time a theme layer issue like this has arisen on an upgrade.

 
Magento Community Magento Community
Magento Community
Magento Community
 
adonkey
Member
 
Total Posts:  67
Joined:  2008-10-28
 

Hi gbear,

I will try that out first thing tomorrow morning and let you know if it fixes it for me,

I have also found a method that works, I can add any custom option I like by simply using this symbol before I start typing :

So this would generate the “One of options row has error” testing testing 1 2 3

however this would process through without erorrs :testing testing 1 2 3

 
Magento Community Magento Community
Magento Community
Magento Community
 
envisionwebgroup
Member
 
Avatar
Total Posts:  37
Joined:  2008-12-11
Orlando, FL
 
gbear - 17 June 2009 12:30 AM

Ran into this on a 1.3.2 update.

In your custom theme, have a look at the page.xml file - will be here:
app/design/frontend/default/YOURTHEME//layout/page.xml

Doing a diff between that file & the same file in the default theme (where adding to cart works) will see a bunch of changes have been rolled in.  But around line 41 it’ll have <action method="addItem"><type>skin_js</type><name>js/effects-1.8.1.js</name></action>

This has changed to:
<action method="addJs"><script>scriptaculous/effects.js</script></action>

Making that change, uploading page.xml, clearing the cache control, solved this for us.

-Greg

Our page.xml already seems to reflect this change.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

I have flat categories and flat products off.
I have noticed that once a simple product is added to the basket via the product page, the product can then be added to the cart via the categories page.

I am otherwise receiving the Please specify the product required option(s) error on a simple product with no custom options.
Using Magento 1.3.2.2.

update: this does not appear to always be the case. Weird stupid bug.  I thought it was well fixed many releases ago.

 
Magento Community Magento Community
Magento Community
Magento Community
 
alex.bsc
Guru
 
Total Posts:  340
Joined:  2008-06-06
 

So is there a solution for 1.3.2.2 using e.g. blue theme to be able to use ADD TO CART buttons when viewing products in the categories?
At present, it does NOT WORK.  I am redirected to the product page with the warning ‘Please specify the product required option(s)’.

Reported;
http://www.magentocommerce.com/bug-tracking/issue?issue=6936

 
Magento Community Magento Community
Magento Community
Magento Community
 
TableLinens
Jr. Member
 
Total Posts:  12
Joined:  2008-11-19
Laguna Hills, CA
 

We have the same issue… website is now out of business because of this bug…

Please specify the product required option(s) error when trying to add to cart

We are looking for a fix and will publish here if successful.

Magento ver. 1.3.2.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
ThemeRock
Jr. Member
 
Total Posts:  1
Joined:  2009-08-02
 

I got same problem for Downloadable products.
My Magento version 1.3.2.3

I’ve found a fix that works, but BACK UP YOUR FILES!!!

I have changed core files, I hope they will fix soon.

app/code/core/Mage/Downloadable/Model/Product/Type.php

change
Line 305 ~

if ($this->getLinkSelectionRequired($product)) {
            
return Mage::helper('downloadable')->__('Please specify product link(s).');
}

to

if ($this->getLinkSelectionRequired($product)) {
       
// Temporary disable until next release     return Mage::helper('downloadable')->__('Please specify product link(s).');
}

This is NOT really good solution but I guess you can use until next release.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Conradson
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2008-12-30
 

Magento v1.2.1.2 solution (don’t know for most recent versions) :

If no required option selected, magento selects the first option by sort order.

Old code in <magento>\app\code\core\Mage\Catalog\Model\Product\Type\Abstract.php

protected function _prepareOptionsForCart($options)
    
{
        $newOptions 
= array();

        foreach (
$this->getProduct()->getOptions() as $_option{
            
/* @var $_option Mage_Catalog_Model_Product_Option */
            
if (!isset($options[$_option->getId()]) && $_option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) {
                
return Mage::helper('catalog')->__('Please specify the product required option(s)');
            
}

Replace by new code :

protected function _prepareOptionsForCart($options)
    
{
        $newOptions 
= array();

        foreach (
$this->getProduct()->getOptions() as $_option{
            
/* @var $_option Mage_Catalog_Model_Product_Option */
            
if (!isset($options[$_option->getId()]) && $_option->getIsRequire() && !$this->getProduct()->getSkipCheckRequiredOption()) {
                $tabOptions 
= array();
                foreach (
$_option->getValues() as $_value{
                    $tabOptions[$_value
->getSortOrder()$_value->getOptionTypeId();
                
}
                
if (count($tabOptions) > 0{
                    ksort
($tabOptions);
                    
$options[$_option->getId()array_shift($tabOptions);
                
else {
                    
return Mage::helper('catalog')->__('Please specify the product required option(s)');
                
}
            }
 
Magento Community Magento Community
Magento Community
Magento Community
 
w4yward
Member
 
Total Posts:  35
Joined:  2008-10-08
 

I’m having a related issue with Required Options. The error I get is

SQLSTATE[42S22]Column not found1054 Unknown column 'e.required_options' in 'on clause'

This is blocking orders from going through on the front end, and the back end, and even from modifying products. Any thoughts, this forum has a lot of good ideas on a similar issue.

I have a thread regarding this at http://www.magentocommerce.com/boards/viewthread/53858/

Running the latest version 1.3.2.3

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top