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

[Again] Awful Update
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

Good morning everyone,

I have still a problem with updating magento system.
My last update put a terrible mess in my websites.

The first problem I observe, I don’t have any custom options show in the front-end.
However, it is still show up in my backend.

The second problem I have, is about database updgrade.
Especially about the catalogInventory status table.

When we want to save a product, I meet an error about foreign key :

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`databasename/cataloginventory_stock_status`, CONSTRAINT `FK_CATALOGINVENTORY_STOCK_STATUS_STOCK` FOREIGN KEY (`stock_id`) REFERENCES `cataloginventory_stock` (`stock_id`) ON DELETE CASCADE ON UPD)

In spite of it save properly my products in database but I don’t have any stock options saved.

I think I would had to stay on older upgrade.
I loose so many orders in order to upgrade magento.

On the other hand, we have so far 10+ thousand orders with magento and we meet many problems about performance issues.
We ought to look up for master and slave servor system to improve traffic issues…
A terrible mess for us, we have to spend many times and plenty of money to manage our servors.

Best Regards,
Ilan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

When I remove

$this->hasOptions()
It show up the customs options.

Where is the problem ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

For the foreign key problem, you need to insert a row in catalogInventory_stock :

INSERT INTO `yourdatabase`.`cataloginventory_stock` (
`
stock_id` ,
`
stock_name`
)
VALUES (
'1''Default'
);

I didn’t have this data in my table.

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

The Custom Options disappearing is a known and now fixed bug, which will be packaged with the 1.2.2 release. In the bug report you can find an SQL statement that fixes it temporarily. Search the issues on “disappearing” and see the one I filed.

If you do more than 10K orders, presumably in under a year, you must also be able to afford load balanced or DB clustered servers.

Any why would you loose orders during an upgrade? Surely you test the upgrade on a dev server first before pushing the changes out to production in under 30 minutes during low-traffic times in the day?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

You are talking about this issue :
http://www.magentocommerce.com/bug-tracking/issue?issue=5120

UPDATE catalog_product_entity
SET has_options = 1
WHERE entity_id IN
(SELECT distinct(product_id) FROM catalog_product_option);

But my options are still hidden.
And I don’t understand one point : Magento team seems have resolved this issue but they don’t communicate on how to fix it ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

That’s the one. If that doesn’t fix it for you, you’ve hit something else.

They rather keep on bug fixing and releasing it the usual way than giving people bitsy patches which may then conflict with the real release again. Most releases take just two weeks so it’s up to you whether to roll back or keep it buggy for a few weeks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

Anyway, thank you for your help.
I will find the solution… for sure.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

The problem is when you come on product informations page, catalog_product_entity table reset has_options to 0.
You may put a cron job with the previous mysql command but it doesn’t solved the problem at all.

The only thing to do is waiting for a fixed release…
Hope soon…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

Ok, I have a temporary fix for this problem.
We need to comment the

$this->setHasOptions(false);
line.

Mage/Catalog/Model/Product.php :

/**
     * Check product options and type options and save them, too
     *
     */
    protected function _beforeSave()
    
{
        $this
->cleanCache();
        
$this->setTypeHasOptions(false);
        
$this->setTypeHasRequiredOptions(false);

        
$this->getTypeInstance()->beforeSave();

        
$hasOptions         false;
        
$hasRequiredOptions false;

        
$this->canAffectOptions($this->_canAffectOptions || $this->getCanSaveCustomOptions());
        if (
$this->getCanSaveCustomOptions()) {
            $options 
$this->getProductOptions();
            if (
is_array($options)) {
                
foreach ($this->getProductOptions() as $option{
                    $this
->getOptionInstance()->addOption($option);
                    if ((!isset(
$option['is_delete'])) || $option['is_delete'!= '1'{
                        $hasOptions 
true;
                    
}
                }
                
foreach ($this->getOptionInstance()->getOptions() as $option{
                        
if ($option['is_require'== '1'{
                            $hasRequiredOptions 
true;
                        break;
                    
}
                }
            }
        }

        
/**
         * Set true, if any
         * Set false, ONLY if options have been affected by Options tab and Type instance tab
         */
        
if ($hasOptions || (bool)$this->getTypeHasOptions()) {
            $this
->setHasOptions(true);
            if (
$hasRequiredOptions || (bool)$this->getTypeHasRequiredOptions()) {
                $this
->setRequiredOptions(true);
            
}
            
elseif ($this->canAffectOptions()) {
                $this
->setRequiredOptions(false);
            
}
        }
        
elseif ($this->canAffectOptions()) {
          
//  $this->setHasOptions(false);
            
$this->setRequiredOptions(false);
        
}
        parent
::_beforeSave();
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

Did you come up with this yourself or did yuo check this out with the latest beta SVN?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mageho
Sr. Member
 
Avatar
Total Posts:  291
Joined:  2008-03-24
France, Paris
 

By myself.
Where I can find the latest svn release ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

http://www.magentocommerce.com/svn

Their official fix should be in the development trunk.

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