Magento v1.3.0: Option validation failed to add product to cart

After upgrading a clients Magento site from 1.2.1.2 to version 1.3.0, they reported an issue not being able to add products with required selectable options, as it would always return “Option validation failed to add product to cart” Message even though all requirements are met.

The issue I’ve found to be is in a newly created file in 1.3.0: /app/code/core/Mage/Catalog/Model/Product/Option/Type/Select.php

1
2
3
4
5
6
7
8
9
10
11
12
13
    /**
     * Prepare option value for cart
     *
     * @throws Mage_Core_Exception
     * @return mixed Prepared option value
     */
    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'));
    }

Apply a comment to the Mage::throwException … and it will fix the issue.

Note the use of a shorthand if statement within the return for the function, which in all honesty is bad coding practice. I say Magento makes the developer go onto code review for the next week for punishment. I’ve known some shops to do this when they get lazy. :lol:

However, $this->getIsValid() will return true, for a few cycles through but ultimately seems to come back to the exception and return false, which leads me to thing there is more to bug than just a simple conditional return statement.

Keep in mind this is by no means a official fix but will tie you over until the bug fix is released, which has already been reported and assigned. Also if you do make this change you may want to keep a copy of the original file as modifying app/core/ can lead to upgrade issues in the future, and you’ll need to restore the original file upon upgrading.

:!: It appears this also has fixed another issue I noticed, within the Admin, attempting to Create a New Order, upon attempting to add products to the order, nothing would be returned and no error presented. After my fix above this now working properly as well. This other issue has also been reported already and assigned as well.

According the 1.2.1.2 to 1.3.0 .diff file, this file is a newly created file.

Here is a forum thread discussing the issue:
:arrow: Magento – Option validation failed to add product to cart – Magento 1.3.0 Upgrade Issues – eCommerce Software for Growth.

Possibly Related Posts:


Build a Forum in Flash / ActionScript.org Forums

While experiementing with Flash 5 and ASP/Access around 2001 I wrote a pretty simplistic based forum with Flash as a frontend.

Still seeing some traffic coming from ActionScripts.org that I had simply experimented with, I’ve since moved away from old ASP, and Access Databases.  It is merely for learning purposes, A Novice person may find it interesting as for more advanced may find it quite amusing :)

I make no warranty with the zip and there isn’t any “install” instructions.

Download it here:
:arrow: mb-forums05b

Build forum in flash – ActionScript.org Forums.

Possibly Related Posts:


RSS Feeds in Magento & Custom Admin Themes from Inchoo

Inchoo.net has been quite busy with Magento it seems, Tomislav Bilic wrote a how to get your WordPress, Joomla, etc. RSS Feeds into Magento with a bit of simple code and no outside libraries, just Zend’s framework to parse and display any RSS feed. I’ve seen quite a few requests for such a feature.

:arrow: Latest News RSS box in Magento using Zend_Feed_Rss | Inchoo.

Ivan Weiler of Inchoo also posted up a really simple but handy Magento Module to allow for custom admin theme, the same way frontend works!

:arrow:  Magento Admin Custom Theme.

So far Inchoo.net’s been one of my favorite 3rd party Magento sites to keep an eye on! :D

Possibly Related Posts:


Same site, shorter domain: mbliss.com

Out of curiousity I wondered if :arrow: mbliss.com was available last night and to my surprise it was available, it hadn’t been in quite some time, since most have trouble spelling the word molotov, I decided to scoop the domain up. I’m still not sure if I will keep it pointing here or if a seperate entity will appear on it and the blog would stay here, I’m mainly concerned with back links and 301 redirecting everything properly. I am also concerned with the domain being parked here if Google will start penalizing me for duplicate content. Anyone have any thoughts, on what would be the best use for this new shortened domain?

Hopefully the thought process will end up like this:
:? :?: :idea: :mrgreen:

Possibly Related Posts:


Magento Login Error after 1.3.0 upgrade fix

After upgrading a fresh out of box 1.2.1.2 and upgrading via MagentoConnect I noticed an error others have reported as well.

:!: Invalid method Mage_Adminhtml_Model_Url::useSecretKey(Array)

It may merely be a permission issue as I didn’t use SSH to perform the upgrade with PEAR, to avoid permission issues. :x

Here’s what fixed it for me, for some reason Usesecretkey.php was not created during an upgrade through MagentoConnect, and Url.php was not updated…

Download the full 1.3.0 zip or tarball and copy Usessecretkey.php and overwriting Url.php:

1
2
\app\code\core\Mage\Adminhtml\Model\System\Config\Backend\Admin\Usesecretkey.php
\app\code\core\Mage\Adminhtml\Model\Url.php

Usesecreykey.php is in the .diff file, and my original install before upgrade was 1.2.1.2, the file didn’t exist before: Note the revision number, and all +’s in the .diff file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Index: app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php
===================================================================
--- app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php	(revision 0)
+++ app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usesecretkey.php	(revision 37005)
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category   Mage
+ * @package    Mage_Adminhtml
+ * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+
+/**
+ * Adminhtml backend model for "Use secret key in Urls" option
+ *
+ * @category   Mage
+ * @package    Mage_Adminhtml
+ * @author     Magento Core Team <core@magentocommerce.com>
+ */
+class Mage_Adminhtml_Model_System_Config_Backend_Admin_Usesecretkey extends Mage_Core_Model_Config_Data
+{
+    protected function _afterSave()
+    {
+        Mage::getSingleton('adminhtml/url')->renewSecretUrls();
+        return $this;
+    }
+}

:arrow: Magento – Login error after upgrade – Magento 1.3.0 Upgrade Issues – eCommerce Software for Growth.

There may be some other inconsistencies but at the moment this is the only issue I’ve encountered with 1.3.0 after an upgrade, feel free to comment and I make no warranty for the above, its merely a fix that worked for me, and isn’t official by any means.

Possibly Related Posts:


Page 10 of 20« First...89101112...20...Last »