cancel
Showing results for 
Search instead for 
Did you mean: 

Weird error with Coupon codes

Weird error with Coupon codes

Hello,

 

I have tried to manage the coupon codes in the admin area and got the below error message. Anyone seen anything similiar? what could be the cause and how can i solve the problem?

 

Thanks for the help.

 

Magento Commerce
There has been an error processing your request
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'times_used' in where clause is ambiguous, query was: SELECT COUNT(*) FROM `salesrule` AS `main_table`
 LEFT JOIN `salesrule_coupon` AS `rule_coupons` ON main_table.rule_id = rule_coupons.rule_id AND rule_coupons.is_primary = 1 WHERE (times_used LIKE '%1%')
Trace: #0 /home/curtyhu1/public_html/store/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array) #1 /home/curtyhu1/public_html/store/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array) #2 /home/curtyhu1/public_html/store/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array) #3 /home/curtyhu1/public_html/store/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT COUNT(*)...', Array) #4 /home/curtyhu1/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(*)...', Array) #5 /home/curtyhu1/public_html/store/lib/Zend/Db/Adapter/Abstract.php(828): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array) #6 /home/curtyhu1/public_html/store/lib/Varien/Data/Collection/Db.php(225): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array) #7 /home/curtyhu1/public_html/store/lib/Varien/Data/Collection.php(225): Varien_Data_Collection_Db->getSize() #8 /home/curtyhu1/public_html/store/lib/Varien/Data/Collection.php(211): Varien_Data_Collection->getLastPageNumber() #9 /home/curtyhu1/public_html/store/lib/Varien/Data/Collection/Db.php(516): Varien_Data_Collection->getCurPage() #10 /home/curtyhu1/public_html/store/lib/Varien/Data/Collection/Db.php(563): Varien_Data_Collection_Db->_renderLimit() #11 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(533): Varien_Data_Collection_Db->load() #12 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Promo/Quote/Grid.php(63): Mage_Adminhtml_Block_Widget_Grid->_prepareCollection() #13 /home/curtyhu1/public_html/store/app/code/local/Bdt/Coupon/Block/Adminhtml/Promo/Quote/Grid.php(59): Mage_Adminhtml_Block_Promo_Quote_Grid->_prepareCollection() #14 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(626): Bdt_Coupon_Block_Adminhtml_Promo_Quote_Grid->_prepareCollection() #15 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php(632): Mage_Adminhtml_Block_Widget_Grid->_prepareGrid() #16 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(918): Mage_Adminhtml_Block_Widget_Grid->_beforeToHtml() #17 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml() #18 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('grid', true) #19 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php(77): Mage_Core_Block_Abstract->getChildHtml('grid') #20 /home/curtyhu1/public_html/store/app/design/adminhtml/default/default/template/widget/grid/container.phtml(36): Mage_Adminhtml_Block_Widget_Grid_Container->getGridHtml() #21 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Template.php(241): include('/home/curtyhu1/...') #22 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #23 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #24 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #25 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Widget/Container.php(308): Mage_Adminhtml_Block_Template->_toHtml() #26 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Widget_Container->_toHtml() #27 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml() #28 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml() #29 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml() #30 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true) #31 /home/curtyhu1/public_html/store/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content') #32 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Template.php(241): include('/home/curtyhu1/...') #33 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...') #34 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView() #35 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml() #36 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Adminhtml_Block_Template->_toHtml() #37 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml() #38 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput() #39 /home/curtyhu1/public_html/store/app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php(61): Mage_Core_Controller_Varien_Action->renderLayout() #40 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Promo_QuoteController->indexAction() #41 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index') #42 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #43 /home/curtyhu1/public_html/store/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch() #44 /home/curtyhu1/public_html/store/app/Mage.php(684): Mage_Core_Model_App->run(Array) #45 /home/curtyhu1/public_html/store/index.php(83): Mage::run('', 'store') #46 {main}

Error log record number: 213614900455

1 REPLY

Re: Weird error with Coupon codes

Hi,

This is obviously not normal behaviour in Magento. From the stack-trace you posted it looks like you have a plugin installed called BDT Coupon.

 

Could you try disabling that and seeing if the error goes away; just so we can see where the issue lies.

 

The error you're seeing means that the SQL statement you are using can see two fields that have the same name; and it doesn't know which one to use.

Problem solved? Click Accept as Solution!
Magento Certified Developer Plus | www.iwebsolutions.co.uk | Magento Small Business Partner