/** * @param Product $product */ private function saveLayouts($product) { if ($product->isLayoutsModified()) { $this->getDb()->query("DELETE FROM product_to_layout WHERE product_id = '" . (int) $product->getId() . "'"); foreach ($product->getLayouts() as $store_id => $layout) { if ($layout['layout_id']) { $this->getDb()->query("INSERT INTO product_to_layout SET product_id = '" . (int) $product->getId() . "', store_id = '" . (int) $store_id . "', layout_id = '" . (int) $layout['layout_id'] . "'"); } } } }