2

I'm using this code on module installer:

$installer = $this;
$installer->startSetup();
$installer->addAttribute("quote_item", "cart_glasses_espessura", array("type"=>"varchar"));
$installer->addAttribute("quote_item", "cart_glasses_right_sphere", array("type"=>"decimal"));
$installer->addAttribute("quote_item", "cart_glasses_right_cylinder", array("type"=>"decimal"));
$installer->addAttribute("quote_item", "cart_glasses_left_sphere", array("type"=>"decimal"));
$installer->addAttribute("quote_item", "cart_glasses_left_cylinder", array("type"=>"decimal"));
$installer->addAttribute("order_item", "cart_glasses_espessura", array("type"=>"decimal"));
$installer->addAttribute("order_item", "cart_glasses_right_sphere", array("type"=>"decimal"));
$installer->addAttribute("order_item", "cart_glasses_right_cylinder", array("type"=>"decimal"));
$installer->addAttribute("order_item", "cart_glasses_left_sphere", array("type"=>"decimal"));
$installer->addAttribute("order_item", "cart_glasses_left_cylinder", array("type"=>"decimal"));
$installer->addAttribute("quote_item", "cart_original_cart_price", array("type"=>"decimal"));
$installer->addAttribute("quote_item", "cart_mood_rule_applied", array("type"=>"varchar"));
$installer->addAttribute("order_item", "cart_original_cart_price", array("type"=>"decimal"));
$installer->addAttribute("order_item", "cart_mood_rule_applied", array("type"=>"varchar"));
$installer->addAttribute("quote_item", "cart_mood_voucher_applied", array("type"=>"varchar"));
$installer->addAttribute("order_item", "cart_mood_voucher_applied", array("type"=>"varchar"));
$installer->addAttribute("quote", "cart_mood_voucher_applied", array("type"=>"varchar"));
$installer->addAttribute("order", "cart_mood_voucher_applied", array("type"=>"varchar"));
$installer->endSetup();

With this i want to add new attributes to my cart and order. On my local it works perfectly and allows me to finish the rest of the code but when i put it online i get an error:

Error in file: "/var/www/website.com/base_folder/app/code/local/Moodoptic/Moodcartrules/sql/salesattribute1510844983_setup/mysql4-install-0.1.0.php" - SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'cart_glasses_right_sphere'

I have checked several times and the attributes are not there before installing. And its working on my local, this is happening only on live.

Why? And someone know wath is the problem?

2
  • u duplicate a cart_glasses_right_sphere twice ligne 4 & 9 Nov 22 '17 at 20:22
  • No, on ligne 4 its for quote_item and on ligne 9 its for order_item Nov 23 '17 at 10:00
1

Your code is perfect and all attribute should be created at one time

The only error That I found that cart_glasses_right_sphere attribute is two-time comment this attribute one time and your error would be solved

Note for You : attribute no2 and no7

For quote_item and order_item magento no longer using Eav structure you can add column by addColumn

2
  • No, one its for quote_item and other for order_item, i tryed this before and does not work. And installing only one field at a time it will install all the fields without any problem. Nov 23 '17 at 11:49
  • @JoséRodrigues For quote_item and order_item magento no longer using attribute you can add column instead adding as a attribute Nov 23 '17 at 12:15
0

I have solved the problem intalling one field at a time, I ran the installer one time for eatch attribute and now its working, its not the perfect solution but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.