Briz Posted August 21, 2018 Share Posted August 21, 2018 Подскажите как можно сделать чтобы в файле google_base показывало только 200 шт товаров, а не все ( потому как их ооочень много). Что нужно дописать в коде? осторе 1.5.4.1 . спасибо большое Link to comment Share on other sites More sharing options...
flai0616 Posted August 21, 2018 Share Posted August 21, 2018 33 минуты назад, Briz сказал: Подскажите как можно сделать чтобы в файле google_base показывало только 200 шт товаров, а не все ( потому как их ооочень много). Что нужно дописать в коде? осторе 1.5.4.1 . спасибо большое Можете скинуть код файла контроллера google base? Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 6 минут назад, flai0616 сказал: Можете скинуть код файла контроллера google base? Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 48 минут назад, Briz сказал: Подскажите как можно сделать чтобы в файле google_base показывало только 200 шт товаров, а не все ( потому как их ооочень много). Что нужно дописать в коде? осторе 1.5.4.1 . спасибо большое Попробуйте этот код (сохраните исходник только:-)). Должно помочь <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { for ($i = 0; $i <= 199; $i++) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 6 минут назад, flai0616 сказал: Попробуйте этот код (сохраните исходник только:-)). Должно помочь <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { for ($i = 0; $i <= 199; $i++) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> что то выдает все ту же ошибку Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) хотя если было 200 товара точно бы загрузилось Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: что то выдает все ту же ошибку Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) хотя если было 200 товара точно бы загрузилось А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 3 минуты назад, flai0616 сказал: А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? 1 Link to comment Share on other sites More sharing options... Bn174uk Posted August 21, 2018 Share Posted August 21, 2018 33 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. 1 Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 43 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 10 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 9 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. Без обид, но для этого случая указана следующая фраза: "Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров." 3 минуты назад, Briz сказал: обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Дайте ссылку на сайт в ЛС) Сейчас посмотрю) 1 Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
Briz Posted August 21, 2018 Author Share Posted August 21, 2018 6 минут назад, flai0616 сказал: Можете скинуть код файла контроллера google base? Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options...
flai0616 Posted August 21, 2018 Share Posted August 21, 2018 48 минут назад, Briz сказал: Подскажите как можно сделать чтобы в файле google_base показывало только 200 шт товаров, а не все ( потому как их ооочень много). Что нужно дописать в коде? осторе 1.5.4.1 . спасибо большое Попробуйте этот код (сохраните исходник только:-)). Должно помочь <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { for ($i = 0; $i <= 199; $i++) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 6 минут назад, flai0616 сказал: Попробуйте этот код (сохраните исходник только:-)). Должно помочь <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { for ($i = 0; $i <= 199; $i++) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> что то выдает все ту же ошибку Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) хотя если было 200 товара точно бы загрузилось Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: что то выдает все ту же ошибку Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) хотя если было 200 товара точно бы загрузилось А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 3 минуты назад, flai0616 сказал: А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? 1 Link to comment Share on other sites More sharing options... Bn174uk Posted August 21, 2018 Share Posted August 21, 2018 33 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. 1 Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 43 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 10 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 9 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. Без обид, но для этого случая указана следующая фраза: "Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров." 3 минуты назад, Briz сказал: обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Дайте ссылку на сайт в ЛС) Сейчас посмотрю) 1 Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
Briz Posted August 21, 2018 Author Share Posted August 21, 2018 6 минут назад, flai0616 сказал: Попробуйте этот код (сохраните исходник только:-)). Должно помочь <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { for ($i = 0; $i <= 199; $i++) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> что то выдает все ту же ошибку Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) хотя если было 200 товара точно бы загрузилось Link to comment Share on other sites More sharing options...
flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: что то выдает все ту же ошибку Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 1024 bytes) хотя если было 200 товара точно бы загрузилось А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 3 минуты назад, flai0616 сказал: А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? 1 Link to comment Share on other sites More sharing options... Bn174uk Posted August 21, 2018 Share Posted August 21, 2018 33 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. 1 Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 43 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 10 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 9 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. Без обид, но для этого случая указана следующая фраза: "Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров." 3 минуты назад, Briz сказал: обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Дайте ссылку на сайт в ЛС) Сейчас посмотрю) 1 Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
Briz Posted August 21, 2018 Author Share Posted August 21, 2018 3 минуты назад, flai0616 сказал: А если так?) <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); foreach ($products as $product) { if ($product['product_id'] <= 200) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Link to comment Share on other sites More sharing options...
flai0616 Posted August 21, 2018 Share Posted August 21, 2018 3 минуты назад, Briz сказал: нет и если я не ошибаюсь то это условие что если товара меньше или ровно 200 то формируется, а уменя товаров 25 000 и мне нужно чтобы только 200 формировалось Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? 1 Link to comment Share on other sites More sharing options... Bn174uk Posted August 21, 2018 Share Posted August 21, 2018 33 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. 1 Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 43 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 10 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 9 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. Без обид, но для этого случая указана следующая фраза: "Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров." 3 минуты назад, Briz сказал: обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Дайте ссылку на сайт в ЛС) Сейчас посмотрю) 1 Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
Bn174uk Posted August 21, 2018 Share Posted August 21, 2018 33 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. 1 Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 43 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Link to comment Share on other sites More sharing options... Briz Posted August 21, 2018 Author Share Posted August 21, 2018 10 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 9 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. Без обид, но для этого случая указана следующая фраза: "Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров." 3 минуты назад, Briz сказал: обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Дайте ссылку на сайт в ЛС) Сейчас посмотрю) 1 Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
Briz Posted August 21, 2018 Author Share Posted August 21, 2018 43 минуты назад, flai0616 сказал: Не совсем) Это условие если id товара < или = 200 - выполнять условие if ($product['description']) Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров. Кеш модификаторов обновляли? обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Link to comment Share on other sites More sharing options...
Briz Posted August 21, 2018 Author Share Posted August 21, 2018 10 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Link to comment Share on other sites More sharing options...
flai0616 Posted August 21, 2018 Share Posted August 21, 2018 9 минут назад, Bn174uk сказал: Не в обиду скажу, но логика у Вас отсутствует. Т.к. в БД могут отсутствовать товары c id меньше 200 и в итоге мы не получим не одного товара. @Briz попробуйте после $products = $this->model_catalog_product->getProducts(); написать $products = array_slice($products,0,200); должно вернуть 200 товаров. Без обид, но для этого случая указана следующая фраза: "Каждому товару в opencart присваивается уникальный идентификатор. возможно, в вашем случае, необходимо изменить цифру 200 на другую, чтобы оказалось именно 200 товаров." 3 минуты назад, Briz сказал: обновляла, хоть убей Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8024 bytes) и все(((( Дайте ссылку на сайт в ЛС) Сейчас посмотрю) 1 Link to comment Share on other sites More sharing options... flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach × Existing user? Sign In Sign Up Shopping section Back Purchased extensions Invoices Whishlist Alternative Contacts Forums ocStore Back Official site Demo ocStore 3.0.3.2 Demo ocStore 2.3.0.2.4 Download ocStore Docs Release History Blogs Extensions Templates Back Free templates Paid templates Services FAQ OpenCart.Pro Back Demo Buy Compare Hosting for OpenCart × Create New... Important Information On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice. I accept
flai0616 Posted August 21, 2018 Share Posted August 21, 2018 7 минут назад, Briz сказал: выдает Parse error: syntax error, unexpected '' (T_STRING) на эту строчку что вставила Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. 1 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base Покупателям Оплата дополнений физическими лицами Оплата дополнений юридическими лицами Политика возвратов Разработчикам Регламент размещения дополнений Регламент продаж и поддержки дополнений Виртуальный аккаунт автора Политика продвижения объявлений API каталога дополнений Урегулирование споров по авторским правам Полезная информация Публичная оферта Политика возвратов Политика конфиденциальности Платежная политика Политика Передачи Персональных Данных Политика прозрачности Последние дополнения Обновление курса валют Приватбанк, Монобанк, НБУ для Opencart/Ocstore By bogdan281989 Deluxe - адаптивный, универсальный шаблон By aridius Кнопка view в списках (товар, категория, производитель, статья) By chukcha Автоматическое заполнение URL для 4.0 By chukcha Шаблон Nice (Free Edition) для OpenCart 3 By SergeTkach
Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 часов назад, flai0616 сказал: Решение товарища @Bn174uk должно быть правильным. Возможно вы не удалили закрывающую скобку моего цикла. Попробуйте его рекомендацию написать в своем изначальном файле - должно помочь. вставляю даже в оригинал все равно ошибка эта Link to comment Share on other sites More sharing options...
Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options... Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page. Последние темы Последние дополнения Последние новости All Activity Home Поддержка и ответы на вопросы Песочница google base
Briz Posted August 22, 2018 Author Share Posted August 22, 2018 32 минуты назад, Bn174uk сказал: Уверены, что правильно вставили? Должно быть так http://prntscr.com/klka70 Проверил даже на тестовом http://test15.cmsshop.com.ua/index.php?route=feed/google_base вывело 3и товара, вместо 19шт. Link to comment Share on other sites More sharing options...
Briz Posted August 22, 2018 Author Share Posted August 22, 2018 Спойлер <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Link to comment Share on other sites More sharing options...
Bn174uk Posted August 22, 2018 Share Posted August 22, 2018 27 минут назад, Briz сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. 2 Link to comment Share on other sites More sharing options... iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0 Go to topic listing Similar Content Google Отзывы клиентов (Google Reviews) для Opencart By bogdan281989, March 15, 2021 google google review (and 1 more) Tagged with: google google review google отзывы 0 comments 1,880 views bogdan281989 March 16, 2021 Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light By bogdan281989, September 19, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 0 comments 10,809 views bogdan281989 September 19, 2020 Модуль Фид для Google Merchants (Google shopping) для Opencart - Google Feed Merchants Light [Поддержка] 1 2 3 4 By bogdan281989, September 25, 2020 google shopping merchant feed (and 1 more) Tagged with: google shopping merchant feed google merchant center feed 78 replies 6,937 views bogdan281989 Monday at 08:06 PM Google Indexing Api By chukcha, December 18, 2021 индексация opencart индексация гугл (and 3 more) Tagged with: индексация opencart индексация гугл индексация сайта индексация продвижение индексация seo анализ 0 comments 4,437 views chukcha December 19, 2021 Google Merchant Shopping Feeds (Списки товаров для Google Shopping) By kirians, September 28, 2020 google shoping feeds (and 2 more) Tagged with: google shoping feeds merchant shoping 0 comments 2,636 views kirians September 28, 2020 Recently Browsing 0 members No registered users viewing this page.
iglin Posted August 22, 2018 Share Posted August 22, 2018 39 минут назад, Briz сказал: Показать контент <?php class ControllerFeedGoogleBase extends Controller { public function index() { if ($this->config->get('google_base_status')) { $output = '<?xml version="1.0" encoding="UTF-8" ?>'; $output .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">'; $output .= '<channel>'; $output .= '<title>' . $this->config->get('config_name') . '</title>'; $output .= '<description>' . $this->config->get('config_meta_description') . '</description>'; $output .= '<link>' . HTTP_SERVER . '</link>'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $products = $this->model_catalog_product->getProducts(); $products = array_slice($products,0,200); foreach ($products as $product) { if ($product['description']) { $output .= '<item>'; $output .= '<title>' . html_entity_decode($product['name'], ENT_QUOTES, 'UTF-8') . '</title>'; $output .= '<link>' . str_replace('&', '&', str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $product['product_id']))) . '</link>'; $output .= '<description><![CDATA[' . strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')) . ']]></description>'; $output .= '<g:brand>' . html_entity_decode($product['manufacturer'], ENT_QUOTES, 'UTF-8') . '</g:brand>'; $output .= '<g:condition>new</g:condition>'; $output .= '<g:id>' . $product['product_id'] . '</g:id>'; if ($product['image']) { $output .= '<g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>'; } else { $output .= '<g:image_link>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</g:image_link>'; } $output .= '<g:mpn>' . $product['model'] . '</g:mpn>'; $supported_currencies = array('UAH', 'USD', 'EUR', 'GBP'); if (in_array($this->currency->getCode(), $supported_currencies)) { $currency = $this->currency->getCode(); } else { $currency = ($this->config->get('google_base_status')) ? $this->config->get('google_base_status') : 'UAH'; } if ((float)$product['special']) { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } else { $output .= '<g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency, false, false) . '</g:price>'; } $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= '<g:product_type>' . $string . '</g:product_type>'; } } $output .= '<g:quantity>' . $product['quantity'] . '</g:quantity>'; $output .= '<g:upc>' . $product['upc'] . '</g:upc>'; $output .= '<g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>'; $output .= '<g:availability>' . ($product['quantity'] ? 'in stock' : 'out of stock') . '</g:availability>'; $output .= '</item>'; } } $output .= '</channel>'; $output .= '</rss>'; $this->response->addHeader('Content-Type: application/rss+xml; charset=utf-8'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } } ?> Удалите пробел после закрывающейся скобочки $products = array_slice($products,0,200)"вот тут"; 2 Link to comment Share on other sites More sharing options... Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options... Create an account or sign in to comment You need to be a member in order to leave a comment Create an account Sign up for a new account in our community. It's easy! Register a new account Sign in Already have an account? Sign in here. Sign In Now Share More sharing options... Followers 0
Briz Posted August 22, 2018 Author Share Posted August 22, 2018 16 минут назад, Bn174uk сказал: Попробуйте эту строчку " $products = array_slice($products,0,200); " руками написать , т.к. когда вставляю Ваш код к себе, тоже самая ошибка, а когда строку пишу заново, все ок, ошибки нет. мистика ,но так сработало))) спасибо Вам большое=))) Link to comment Share on other sites More sharing options...
Recommended Posts