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 1 of 3
Magento 1.4-shopping cart price rules -cann’t add to cart
 
gercol
Jr. Member
 
Total Posts:  10
Joined:  2010-04-07
 

i’v updated my magneto version from 1.3 to 1.4 。but the problem occur!

after i config the ”shopping cart price rules “in the admin , i can’t add my products to the shoping cart in the frontend .( only when i choose the condition to payment method ,it occur !)

i find the exception log :

Exception message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`???`.`sales_flat_quote_payment`, CONSTRAINT `FK_SALES_QUOTE_PAYMENT_SALES_QUOTE` FOREIGN KEY (`quote_id`) REFERENCES `sales_flat_quote` (`entity_id`) ON DELETE CASCADE ON UPDATE CA)
Trace: #0 /var/www/svn/myluxphone.com/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 /var/www/svn/myluxphone.com/lib/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement->execute(Array)
#2 /var/www/svn/myluxphone.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query(’INSERT INTO `sa...’, Array)
#3 /var/www/svn/myluxphone.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract->query(’INSERT INTO `sa...’, Array)
#4 /var/www/svn/myluxphone.com/lib/Zend/Db/Adapter/Abstract.php(546): Varien_Db_Adapter_Pdo_Mysql->query(’INSERT INTO `sa...’, Array)
#5 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(390): Zend_Db_Adapter_Abstract->insert(’sales_flat_quot...’, Array)
#6 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Model/Abstract.php(284): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Sales_Model_Quote_Payment))
#7 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php(222): Mage_Core_Model_Abstract->save()
#8 /var/www/svn/myluxphone.com/app/code/core/Mage/Sales/Model/Quote.php(209): Mage_Core_Model_Mysql4_Collection_Abstract->save()
#9 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Model/Abstract.php(285): Mage_Sales_Model_Quote->_afterSave()
#10 /var/www/svn/myluxphone.com/app/code/core/Mage/Checkout/Model/Cart.php(358): Mage_Core_Model_Abstract->save()
#11 /var/www/svn/myluxphone.com/app/code/core/Mage/Checkout/controllers/CartController.php(177): Mage_Checkout_Model_Cart->save()
#12 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_CartController->addAction()
#13 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch(’add’)
#14 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Controller/Varien/Front.php(177): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#15 /var/www/svn/myluxphone.com/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#16 /var/www/svn/myluxphone.com/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#17 /var/www/svn/myluxphone.com/index.php(78): Mage::run(’’, ‘store’)
#18 {main}

i’ve tried to solve the issues: 
use the app\code\core\Mage\SalesRule of 1.3 to replace the new one ,and then the products go to cart,
but the discount of the price can’t been counted .

some guys can help me , i really think it’s a bug of 1.4 ,because of the problem also appending in a new installed magento 1.4 。

 
Magento Community Magento Community
Magento Community
Magento Community
 
gercol
Jr. Member
 
Total Posts:  10
Joined:  2010-04-07
 

good job , thx bzhang vm !  now i can add pros to cart ,and aslo ,the discount is right !

but in some other Projects ,when i choose the condition to “payment method” in Shopping Cart Price Rules ,the web redirect to dashboard !?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mattse
Jr. Member
 
Total Posts:  9
Joined:  2009-08-05
Germany
 

thanks bzhang! had the same issue! have you entered a bug report for this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
PavelPolyakov
Sr. Member
 
Total Posts:  98
Joined:  2009-08-17
 

Thank you very much.
I was faced with this bug also.

But couldn’t find the solution for a long time. Google had indexed this topic only today smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
zhangbopeng
Jr. Member
 
Total Posts:  15
Joined:  2010-01-29
 

1.4.0.1
I met this issue on the server days ago.When I have a test on my local computer,I works normally.I guess there are some files wrong on the server but I don’t know which one is wrong.

Here is the report in “var/report”

a:5:{i:0;s:292:"Warning: include(/home/fashionb/public_html/app/design/frontend/base/default/template/page/homepage.phtml) [<a href=’function.include’>function.include</a>]: failed to open stream: No such file or directory in /home/fashionb/public_html/app/code/core/Mage/Core/Block/Template.php on line 189";i:1;s:2072:"#0 /home/fashionb/public_html/app/code/core/Mage/Core/Block/Template.php(189): mageCoreErrorHandler(2, ‘include(/home/f...’, ‘/home/fashionb/...’, 189, Array)
#1 /home/fashionb/public_html/app/code/core/Mage/Core/Block/Template.php(189): Mage_Core_Block_Template::fetchView()
#2 /home/fashionb/public_html/app/code/core/Mage/Core/Block/Template.php(225): Mage_Core_Block_Template->fetchView(’frontend/base/d...’)
#3 /home/fashionb/public_html/app/code/core/Mage/Core/Block/Template.php(242): Mage_Core_Block_Template->renderView()
#4 /home/fashionb/public_html/app/code/core/Mage/Core/Block/Abstract.php(674): Mage_Core_Block_Template->_toHtml()
#5 /home/fashionb/public_html/app/code/core/Mage/Core/Model/Layout.php(536): Mage_Core_Block_Abstract->toHtml()
#6 /home/fashionb/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(389): Mage_Core_Model_Layout->getOutput()
#7 /home/fashionb/public_html/app/code/core/Mage/Cms/Helper/Page.php(126): Mage_Core_Controller_Varien_Action->renderLayout()
#8 /home/fashionb/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), ‘home’)
#9 /home/fashionb/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), ‘home’)
#10 /home/fashionb/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#11 /home/fashionb/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#12 /home/fashionb/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(177): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /home/fashionb/public_html/app/code/core/Mage/Core/Model/App.php(304): Mage_Core_Controller_Varien_Front->dispatch()
#14 /home/fashionb/public_html/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#15 /home/fashionb/public_html/index.php(78): Mage::run(’’, ‘store’)
#16 {main}”;s:3:"url”;s:1:"/”;s:11:"script_name”;s:10:"/index.php”;s:4:"skin”;s:7:"default";}

Anyone can help me?
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
zhangbopeng
Jr. Member
 
Total Posts:  15
Joined:  2010-01-29
 

Dear bzhang:
Thanks for you reply.
I overwrite the file template.php with my local one,so it seems work,thank you very much.
If you want to come to China,I will be glad to introduce you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zhangbopeng
Jr. Member
 
Total Posts:  15
Joined:  2010-01-29
 

Dear bzhang:
The problem is still there : (
When I flush the cache,the problems appear again.
I may mistake the temple.php to be the issue.
Need your help!

ps:When I active the shopping cart price rule,this error apprears,but when I inactive it ,I can add to cart.What I want is customers can enjoy 10% discount when they pay by West Union.I have a setting the same as the local one,which works well.So what’s problem?

Exception message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`fashionb_sfMXyma/xvul_sales_flat_quote_payment`, CONSTRAINT `FK_SALES_QUOTE_PAYMENT_SALES_QUOTE` FOREIGN KEY (`quote_id`) REFERENCES `xvul_sales_flat_quote` (`entity_id`) ON DELETE CASCADE ON)
Trace: #0 /home/fashionb/public_html/includes/src/__default.php(47388): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/fashionb/public_html/includes/src/__default.php(39317): Zend_Db_Statement->execute(Array)
#2 /home/fashionb/public_html/includes/src/__default.php(40338): Zend_Db_Adapter_Abstract->query(’INSERT INTO `xv...’, Array)
#3 /home/fashionb/public_html/includes/src/__default.php(41088): Zend_Db_Adapter_Pdo_Abstract->query(’INSERT INTO `xv...’, Array)
#4 /home/fashionb/public_html/includes/src/__default.php(39395): Varien_Db_Adapter_Pdo_Mysql->query(’INSERT INTO `xv...’, Array)
#5 /home/fashionb/public_html/includes/src/__default.php(9604): Zend_Db_Adapter_Abstract->insert(’xvul_sales_flat...’, Array)
#6 /home/fashionb/public_html/includes/src/__default.php(4401): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Sales_Model_Quote_Payment))
#7 /home/fashionb/public_html/includes/src/__default.php(27394): Mage_Core_Model_Abstract->save()
#8 /home/fashionb/public_html/includes/src/__checkout.php(29195): Mage_Core_Model_Mysql4_Collection_Abstract->save()
#9 /home/fashionb/public_html/includes/src/__default.php(4402): Mage_Sales_Model_Quote->_afterSave()
#10 /home/fashionb/public_html/includes/src/__default.php(8133): Mage_Core_Model_Abstract->save()
#11 /home/fashionb/public_html/app/code/core/Mage/Checkout/controllers/CartController.php(177): Mage_Checkout_Model_Cart->save()
#12 /home/fashionb/public_html/includes/src/__default.php(11251): Mage_Checkout_CartController->addAction()
#13 /home/fashionb/public_html/includes/src/__default.php(15150): Mage_Core_Controller_Varien_Action->dispatch(’add’)
#14 /home/fashionb/public_html/includes/src/__default.php(14752): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#15 /home/fashionb/public_html/includes/src/__default.php(16949): Mage_Core_Controller_Varien_Front->dispatch()
#16 /home/fashionb/public_html/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#17 /home/fashionb/public_html/index.php(78): Mage::run(’’, ‘store’)
#18 {main}

 
Magento Community Magento Community
Magento Community
Magento Community
 
ambimax
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-11-06
Saarbrücken, Germany
 

Hi, we had this issue too. So we compared the databases from an updated and a fresh installed version. After we added the following lines to the db, it worked for us (might be from an extension). Can anyone confirm that?

ALTER TABLE `sales_flat_quote_payment
ADD `account_statusvarchar(255) DEFAULT NULL,
ADD `address_statusvarchar(255) DEFAULT NULL,
ADD `protection_eligibilityvarchar(255) DEFAULT NULL,
ADD `ideal_issuer_idvarchar(255) DEFAULT NULL,
ADD `ideal_issuer_listtext
AFTER 
`cc_ss_issue`;

BTW: Try to first deactivate, then to activate all. Maybe this did the trick…

 
Magento Community Magento Community
Magento Community
Magento Community
 
chroust
Jr. Member
 
Total Posts:  20
Joined:  2009-05-11
 

bzhang: THX man, this worked for me.

The problem was that my rules didn’t work for NOT LOGGED IN users, it simply couldn’t add items to the cart. There was no problem for logged users. Now it seems to work for everybody. I think it’s because I used rule based on shipping and payment method.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Volly
Jr. Member
 
Total Posts:  16
Joined:  2009-09-23
 

Have the same problem, don’t try the solution yet - but it looks good.

I’m interested to know which modules/plugins you uses, that can cause the problem. Maybe we found an common divisor.
Me using:
- German Shop (0.1.10 by Techdivistion)
- CashOnDelivery (1.4.1)
- IG CashOnDelivery (1.0.5 - not longer used)
- LoginCatalog (1.0.9 by Netzarbeiter)

on an Magento 1.4.01 with two stores.

I already have checked some of the sql-setups of my modules, but can’t find an possible troublemaker.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Volly
Jr. Member
 
Total Posts:  16
Joined:  2009-09-23
 

@TSDesigns
This Solution dont work for me.
I have also searched same old db-backups and can’t find the table structure you described.

Maybe a different problem.

@zhangbopeng
Did you solve your Problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jmnieto
Jr. Member
 
Total Posts:  12
Joined:  2010-04-18
 

I have the same problem.Anyone has a solution for this ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ambimax
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-11-06
Saarbrücken, Germany
 

@Volley: You are right. The fix had nothing to do with this error. But changing the function as mentioned above worked finally.

In /app/code/core/mage/sales/model/quote.php change the function around line 807

public function getPaymentsCollection()
{
    
if (is_null($this->_payments)) {
        $this
->_payments Mage::getModel('sales/quote_payment')->getCollection();

        if (
$this->getId()) {
            $this
->_payments->setQuoteFilter($this->getId());
            foreach (
$this->_payments as $payment{
                $payment
->setQuote($this);
            
}
        }
    }
    
return $this->_payments;
}

Does anybody know if upgrade to 1.4.1.0 solved the problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Volly
Jr. Member
 
Total Posts:  16
Joined:  2009-09-23
 

hi jmnieto,
when you can\’t add a item to the cart, there many possiblities of bugs. Cause any PHP-Error in the cart or Payment-system can cause this. Check your log to ensure you have the same error.

extracts from my log:

Exception messageSQLSTATE[23000]Integrity constraint violation1452 Cannot add or update a child rowa foreign key constraint fails (`???`.`sales_flat_quote_payment`, CONSTRAINT `FK_SALES_QUOTE_PAYMENT_SALES_QUOTEFOREIGN KEY (`quote_id`) REFERENCES `sales_flat_quote` (`entity_id`) ON DELETE CASCADE ON UPDATE CA
....
/var/
www/svn/myluxphone.com/app/code/core/Mage/Sales/Model/Quote.php(209): Mage_Core_Model_Mysql4_Collection_Abstract->save() 
...

As you can see its a slightly differents to the log of zhangbopeng, which main error seems ot be in

/home/fashionb/public_html/app/code/core/Mage/Checkout/controllers/CartController.php(177): Mage_Checkout_Model_Cart->save()

I found the solution for my problem in:
http://www.magentocommerce.com/boards/viewthread/178371/ (second post)

EDIT: TSDesign was a bit faster. ^^
@TSDesign found the same solution, but have also the same question about 1.4.1.
I visited the diff-log and found there are many changes in quote.php - but i can not say if the problem is solved.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ambimax
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-11-06
Saarbrücken, Germany
 

A better alternative to the code above would be to add the following function just above

/*********************** PAYMENTS ***************************/

or somewhere else within the class. I figgured this out when using 1.4.1.0, didn’t work anymore with the code above.

public function getId()
{
    
return (int) parent::getId();
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
ambimax
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-11-06
Saarbrücken, Germany
 

sorry, you need more than 0.

public function getId()
    
{
        $id 
parent::getId();
        return 
$id $id 1;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3