Post by orcunbaslak » Fri Sep 07, 2018 11:02 pm

Arkadaşlar merhaba,

Gördüğüm kadarıyla bu Google Merchant'a Feed beslemesi yapmak için gerekli olan plug-in verimli çalışmıyor ve bu iş için pek çok extension satılıyor. Mevcut kodu düzelterek Google Merchant'a uyumlu hale getirdim. İsteyen arkadaşlar buradan kopyala yapıştır yaparak kullanabilirler.

/catalog/controller/extension/feed altındaki google_base.php dosyasının içeriğini aşağıdaki gibi değiştirin. openCart 3.0.2.0'da test edildi.

Code: Select all

<?php
class ControllerExtensionFeedGoogleBase extends Controller {
	public function index() {
		if ($this->config->get('feed_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->replace_tr($this->config->get('config_meta_description')) . '</description>';
			$output .= '  <link>' . $this->config->get('config_url') . '</link>';

			$this->load->model('extension/feed/google_base');
			$this->load->model('catalog/category');
			$this->load->model('catalog/product');

			$this->load->model('tool/image');

			$product_data = array();

			$google_base_categories = $this->model_extension_feed_google_base->getCategories();

			foreach ($google_base_categories as $google_base_category) {
				$filter_data = array(
					'filter_category_id' => $google_base_category['category_id'],
					'filter_filter'      => false
				);

				$products = $this->model_catalog_product->getProducts($filter_data);

				foreach ($products as $product) {
					if (!in_array($product['product_id'], $product_data) && $product['description']) {
						
						$product_data[] = $product['product_id'];
						
						$output .= '<item>';
						$output .= '<title><![CDATA[' . html_entity_decode($this->replace_tr($product['name'])) . ']]></title>';
						$output .= '<link>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</link>';
						$output .= '<description><![CDATA[' . strip_tags(html_entity_decode($this->replace_tr($product['description']), ENT_QUOTES, 'UTF-8')) . ']]></description>';
						$output .= '<g:brand><![CDATA[' . html_entity_decode($this->replace_tr($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></g:image_link>';
						}

						$output .= '  <g:model_number>' . $product['model'] . '</g:model_number>';

						if ($product['mpn']) {
							$output .= '  <g:mpn><![CDATA[' . $product['mpn'] . ']]></g:mpn>' ;
						} else {
							$output .= '  <g:identifier_exists>false</g:identifier_exists>';
						}

						if ($product['upc']) {
							$output .= '  <g:upc>' . $product['upc'] . '</g:upc>';
						}

						if ($product['ean']) {
							$output .= '  <g:ean>' . $product['ean'] . '</g:ean>';
						}

						$currencies = array(
							'TRY',
						);

						if (in_array($this->session->data['currency'], $currencies)) {
							$currency_code = $this->session->data['currency'];
							$currency_value = $this->currency->getValue($this->session->data['currency']);
						} else {
							$currency_code = 'TRY';
							$currency_value = $this->currency->getValue('TRY');
						}

						if ((float)$product['special']) {
							$output .= '  <g:price>' .  $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						} else {
							$output .= '  <g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						}

						$output .= '  <g:google_product_category>' . $google_base_category['google_base_category_id'] . '</g:google_product_category>';

						$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 .= ' &gt; ' . $category_info['name'];
										}
									}
								}

								$output .= '<g:product_type><![CDATA[' . html_entity_decode($this->replace_tr($string)) . ']]></g:product_type>';
							}
						}

						$output .= '  <g:quantity>' . $product['quantity'] . '</g:quantity>';
						$output .= '  <g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>';
						$output .= '  <g:availability><![CDATA[' . ($product['quantity'] ? 'in stock' : 'out of stock') . ']]></g:availability>';
						$output .= '</item>';
					}
				}
			}

			$output .= '  </channel>';
			$output .= '</rss>';

			$this->response->addHeader('Content-Type: application/rss+xml');
			$this->response->setOutput($output);
		}
	}
	
    public function replace_tr($text) {
        $text = trim($text);
        $search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü');
        $replace = array('C','c','G','g','i','I','O','o','S','s','U','u');
        $new_text = str_replace($search,$replace,$text);
        return $new_text;
    } 

	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;
			}
		}
	}
}

Newbie

Posts

Joined
Sat Aug 04, 2018 6:19 pm

Post by kazancliofisweb » Thu Nov 22, 2018 10:58 pm

Merhaba,
Bende sorun yaşıyorum ama sizin kodunuzla halledemedim.Ürünler gelmiyor.
Nasıl çözebilirim bilginiz var mıdır?
Teşekkürler


Posts

Joined
Thu Nov 22, 2018 10:57 pm

Post by eka7a » Sun Jan 06, 2019 3:29 am

Merhaba,
OpenCart v3.0.2.0 için buradaki eklentiyi kullanabilirsiniz. OpenCart v3.0.3.0 sürümünde kendi içerisinde mevcut.

Windows 11 Pro Digital License Key


User avatar
Active Member

Posts

Joined
Sun Apr 12, 2009 12:59 am
Location - Türkiye

Post by LG700 » Fri Apr 19, 2019 12:00 am

o eklenti ücretsiz gibi görünüyor ama %7,5 komisyon kesiyor her işlemde

arkadaşın verdiği kodla yaptım çok işime yaradı teşekkür ederim.

Newbie

Posts

Joined
Mon Jan 10, 2011 12:46 am

Post by rivasol » Sun May 10, 2020 5:41 am

teşekkürler arkaşadaşım. eklenti kurmaktan kurtardın beni.

Opencart Sürüm 3.0.3.2 Test Edildi Sorunsuz Çalışıyor

Bitkilerde, çiçeklerde, orkidede, sukulente solucan gübresi nasıl kullanılır. çiçeklerine iyi bakmak için solucan gübresi satın alıp bitkilerine iyi bakabilirsiniz. en iyi sıvı solucan gübresi, rivasol tarımdan satın alınır.


User avatar
Newbie

Posts

Joined
Sat Apr 27, 2019 8:27 am

Post by abdullahTR » Tue Jul 21, 2020 2:23 am

merhaba bir türlü şu mercantı yapamadım ürünleri yüklüyor ama onaylamıyor bunun sebebi ne olabilir yada ne yapmam lazım

New member

Posts

Joined
Tue May 12, 2020 8:44 pm

Post by Alaque123 » Thu Oct 22, 2020 6:50 pm

orcunbaslak wrote:
Fri Sep 07, 2018 11:02 pm
Arkadaşlar merhaba,

Gördüğüm kadarıyla bu Google Merchant'a Feed beslemesi yapmak için gerekli olan plug-in verimli çalışmıyor ve bu iş için pek çok extension satılıyor. Mevcut kodu düzelterek Google Merchant'a uyumlu hale getirdim. İsteyen arkadaşlar buradan kopyala yapıştır yaparak kullanabilirler.

/catalog/controller/extension/feed altındaki google_base.php dosyasının içeriğini aşağıdaki gibi değiştirin. openCart 3.0.2.0'da test edildi.

Code: Select all

<?php
class ControllerExtensionFeedGoogleBase extends Controller {
	public function index() {
		if ($this->config->get('feed_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->replace_tr($this->config->get('config_meta_description')) . '</description>';
			$output .= '  <link>' . $this->config->get('config_url') . '</link>';

			$this->load->model('extension/feed/google_base');
			$this->load->model('catalog/category');
			$this->load->model('catalog/product');

			$this->load->model('tool/image');

			$product_data = array();

			$google_base_categories = $this->model_extension_feed_google_base->getCategories();

			foreach ($google_base_categories as $google_base_category) {
				$filter_data = array(
					'filter_category_id' => $google_base_category['category_id'],
					'filter_filter'      => false
				);

				$products = $this->model_catalog_product->getProducts($filter_data);

				foreach ($products as $product) {
					if (!in_array($product['product_id'], $product_data) && $product['description']) {
						
						$product_data[] = $product['product_id'];
						
						$output .= '<item>';
						$output .= '<title><![CDATA[' . html_entity_decode($this->replace_tr($product['name'])) . ']]></title>';
						$output .= '<link>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</link>';
						$output .= '<description><![CDATA[' . strip_tags(html_entity_decode($this->replace_tr($product['description']), ENT_QUOTES, 'UTF-8')) . ']]></description>';
						$output .= '<g:brand><![CDATA[' . html_entity_decode($this->replace_tr($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></g:image_link>';
						}

						$output .= '  <g:model_number>' . $product['model'] . '</g:model_number>';

						if ($product['mpn']) {
							$output .= '  <g:mpn><![CDATA[' . $product['mpn'] . ']]></g:mpn>' ;
						} else {
							$output .= '  <g:identifier_exists>false</g:identifier_exists>';
						}

						if ($product['upc']) {
							$output .= '  <g:upc>' . $product['upc'] . '</g:upc>';
						}

						if ($product['ean']) {
							$output .= '  <g:ean>' . $product['ean'] . '</g:ean>';
						}

						$currencies = array(
							'TRY',
						);

						if (in_array($this->session->data['currency'], $currencies)) {
							$currency_code = $this->session->data['currency'];
							$currency_value = $this->currency->getValue($this->session->data['currency']);
						} else {
							$currency_code = 'TRY';
							$currency_value = $this->currency->getValue('TRY');
						}

						if ((float)$product['special']) {
							$output .= '  <g:price>' .  $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						} else {
							$output .= '  <g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						}

						$output .= '  <g:google_product_category>' . $google_base_category['google_base_category_id'] . '</g:google_product_category>';

						$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 .= ' &gt; ' . $category_info['name'];
										}
									}
								}

								$output .= '<g:product_type><![CDATA[' . html_entity_decode($this->replace_tr($string)) . ']]></g:product_type>';
							}
						}

						$output .= '  <g:quantity>' . $product['quantity'] . '</g:quantity>';
						$output .= '  <g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>';
						$output .= '  <g:availability><![CDATA[' . ($product['quantity'] ? 'in stock' : 'out of stock') . ']]></g:availability>';
						$output .= '</item>';
					}
				}
			}

			$output .= '  </channel>';
			$output .= '</rss>';

			$this->response->addHeader('Content-Type: application/rss+xml');
			$this->response->setOutput($output);
		}
	}
	
    public function replace_tr($text) {
        $text = trim($text);
        $search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü');
        $replace = array('C','c','G','g','i','I','O','o','S','s','U','u');
        $new_text = str_replace($search,$replace,$text);
        return $new_text;
    } 

	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;
			}
		}
	}
}

Hocam kod çalışıyor ama ürün fiyatını Tl olarak yazdırmıyor <g:price>6,00 ₺</g:price> böyle yazdrıyıyor

Newbie

Posts

Joined
Tue Feb 04, 2020 8:33 am

Post by rivasol » Tue Nov 24, 2020 6:33 am

kazancliofisweb wrote:
Thu Nov 22, 2018 10:58 pm
Merhaba,
Bende sorun yaşıyorum ama sizin kodunuzla halledemedim.Ürünler gelmiyor.
Nasıl çözebilirim bilginiz var mıdır?
Teşekkürler
google merchatta onaylanmayan ürünlerin nedeni belirtilir, opencartın beslemesiyle ilgili değildir. verilen hatayı yazarsan sana yardımcı olurum.

Bitkilerde, çiçeklerde, orkidede, sukulente solucan gübresi nasıl kullanılır. çiçeklerine iyi bakmak için solucan gübresi satın alıp bitkilerine iyi bakabilirsiniz. en iyi sıvı solucan gübresi, rivasol tarımdan satın alınır.


User avatar
Newbie

Posts

Joined
Sat Apr 27, 2019 8:27 am

Post by rivasol » Tue Nov 24, 2020 6:57 am

Alaque123 wrote:
Thu Oct 22, 2020 6:50 pm
orcunbaslak wrote:
Fri Sep 07, 2018 11:02 pm
Arkadaşlar merhaba,

Gördüğüm kadarıyla bu Google Merchant'a Feed beslemesi yapmak için gerekli olan plug-in verimli çalışmıyor ve bu iş için pek çok extension satılıyor. Mevcut kodu düzelterek Google Merchant'a uyumlu hale getirdim. İsteyen arkadaşlar buradan kopyala yapıştır yaparak kullanabilirler.

/catalog/controller/extension/feed altındaki google_base.php dosyasının içeriğini aşağıdaki gibi değiştirin. openCart 3.0.2.0'da test edildi.

Code: Select all

<?php
class ControllerExtensionFeedGoogleBase extends Controller {
	public function index() {
		if ($this->config->get('feed_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->replace_tr($this->config->get('config_meta_description')) . '</description>';
			$output .= '  <link>' . $this->config->get('config_url') . '</link>';

			$this->load->model('extension/feed/google_base');
			$this->load->model('catalog/category');
			$this->load->model('catalog/product');

			$this->load->model('tool/image');

			$product_data = array();

			$google_base_categories = $this->model_extension_feed_google_base->getCategories();

			foreach ($google_base_categories as $google_base_category) {
				$filter_data = array(
					'filter_category_id' => $google_base_category['category_id'],
					'filter_filter'      => false
				);

				$products = $this->model_catalog_product->getProducts($filter_data);

				foreach ($products as $product) {
					if (!in_array($product['product_id'], $product_data) && $product['description']) {
						
						$product_data[] = $product['product_id'];
						
						$output .= '<item>';
						$output .= '<title><![CDATA[' . html_entity_decode($this->replace_tr($product['name'])) . ']]></title>';
						$output .= '<link>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</link>';
						$output .= '<description><![CDATA[' . strip_tags(html_entity_decode($this->replace_tr($product['description']), ENT_QUOTES, 'UTF-8')) . ']]></description>';
						$output .= '<g:brand><![CDATA[' . html_entity_decode($this->replace_tr($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></g:image_link>';
						}

						$output .= '  <g:model_number>' . $product['model'] . '</g:model_number>';

						if ($product['mpn']) {
							$output .= '  <g:mpn><![CDATA[' . $product['mpn'] . ']]></g:mpn>' ;
						} else {
							$output .= '  <g:identifier_exists>false</g:identifier_exists>';
						}

						if ($product['upc']) {
							$output .= '  <g:upc>' . $product['upc'] . '</g:upc>';
						}

						if ($product['ean']) {
							$output .= '  <g:ean>' . $product['ean'] . '</g:ean>';
						}

						$currencies = array(
							'TRY',
						);

						if (in_array($this->session->data['currency'], $currencies)) {
							$currency_code = $this->session->data['currency'];
							$currency_value = $this->currency->getValue($this->session->data['currency']);
						} else {
							$currency_code = 'TRY';
							$currency_value = $this->currency->getValue('TRY');
						}

						if ((float)$product['special']) {
							$output .= '  <g:price>' .  $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						} else {
							$output .= '  <g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						}

						$output .= '  <g:google_product_category>' . $google_base_category['google_base_category_id'] . '</g:google_product_category>';

						$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 .= ' &gt; ' . $category_info['name'];
										}
									}
								}

								$output .= '<g:product_type><![CDATA[' . html_entity_decode($this->replace_tr($string)) . ']]></g:product_type>';
							}
						}

						$output .= '  <g:quantity>' . $product['quantity'] . '</g:quantity>';
						$output .= '  <g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>';
						$output .= '  <g:availability><![CDATA[' . ($product['quantity'] ? 'in stock' : 'out of stock') . ']]></g:availability>';
						$output .= '</item>';
					}
				}
			}

			$output .= '  </channel>';
			$output .= '</rss>';

			$this->response->addHeader('Content-Type: application/rss+xml');
			$this->response->setOutput($output);
		}
	}
	
    public function replace_tr($text) {
        $text = trim($text);
        $search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü');
        $replace = array('C','c','G','g','i','I','O','o','S','s','U','u');
        $new_text = str_replace($search,$replace,$text);
        return $new_text;
    } 

	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;
			}
		}
	}
}

Hocam kod çalışıyor ama ürün fiyatını Tl olarak yazdırmıyor <g:price>6,00 ₺</g:price> böyle yazdrıyıyor
web sitenin google base feedini paylaşırsan yardımcı olurum. web sitenin kurundan dolayı olabilir doğru ayarlanması gerekir.

Bitkilerde, çiçeklerde, orkidede, sukulente solucan gübresi nasıl kullanılır. çiçeklerine iyi bakmak için solucan gübresi satın alıp bitkilerine iyi bakabilirsiniz. en iyi sıvı solucan gübresi, rivasol tarımdan satın alınır.


User avatar
Newbie

Posts

Joined
Sat Apr 27, 2019 8:27 am

Post by ahcan » Sat Nov 06, 2021 1:40 pm

orcunbaslak wrote:
Fri Sep 07, 2018 11:02 pm
Arkadaşlar merhaba,

Gördüğüm kadarıyla bu Google Merchant'a Feed beslemesi yapmak için gerekli olan plug-in verimli çalışmıyor ve bu iş için pek çok extension satılıyor. Mevcut kodu düzelterek Google Merchant'a uyumlu hale getirdim. İsteyen arkadaşlar buradan kopyala yapıştır yaparak kullanabilirler.

/catalog/controller/extension/feed altındaki google_base.php dosyasının içeriğini aşağıdaki gibi değiştirin. openCart 3.0.2.0'da test edildi.

Code: Select all

<?php
class ControllerExtensionFeedGoogleBase extends Controller {
	public function index() {
		if ($this->config->get('feed_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->replace_tr($this->config->get('config_meta_description')) . '</description>';
			$output .= '  <link>' . $this->config->get('config_url') . '</link>';

			$this->load->model('extension/feed/google_base');
			$this->load->model('catalog/category');
			$this->load->model('catalog/product');

			$this->load->model('tool/image');

			$product_data = array();

			$google_base_categories = $this->model_extension_feed_google_base->getCategories();

			foreach ($google_base_categories as $google_base_category) {
				$filter_data = array(
					'filter_category_id' => $google_base_category['category_id'],
					'filter_filter'      => false
				);

				$products = $this->model_catalog_product->getProducts($filter_data);

				foreach ($products as $product) {
					if (!in_array($product['product_id'], $product_data) && $product['description']) {
						
						$product_data[] = $product['product_id'];
						
						$output .= '<item>';
						$output .= '<title><![CDATA[' . html_entity_decode($this->replace_tr($product['name'])) . ']]></title>';
						$output .= '<link>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</link>';
						$output .= '<description><![CDATA[' . strip_tags(html_entity_decode($this->replace_tr($product['description']), ENT_QUOTES, 'UTF-8')) . ']]></description>';
						$output .= '<g:brand><![CDATA[' . html_entity_decode($this->replace_tr($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></g:image_link>';
						}

						$output .= '  <g:model_number>' . $product['model'] . '</g:model_number>';

						if ($product['mpn']) {
							$output .= '  <g:mpn><![CDATA[' . $product['mpn'] . ']]></g:mpn>' ;
						} else {
							$output .= '  <g:identifier_exists>false</g:identifier_exists>';
						}

						if ($product['upc']) {
							$output .= '  <g:upc>' . $product['upc'] . '</g:upc>';
						}

						if ($product['ean']) {
							$output .= '  <g:ean>' . $product['ean'] . '</g:ean>';
						}

						$currencies = array(
							'TRY',
						);

						if (in_array($this->session->data['currency'], $currencies)) {
							$currency_code = $this->session->data['currency'];
							$currency_value = $this->currency->getValue($this->session->data['currency']);
						} else {
							$currency_code = 'TRY';
							$currency_value = $this->currency->getValue('TRY');
						}

						if ((float)$product['special']) {
							$output .= '  <g:price>' .  $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						} else {
							$output .= '  <g:price>' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency_code, $currency_value, true) . '</g:price>';
						}

						$output .= '  <g:google_product_category>' . $google_base_category['google_base_category_id'] . '</g:google_product_category>';

						$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 .= ' &gt; ' . $category_info['name'];
										}
									}
								}

								$output .= '<g:product_type><![CDATA[' . html_entity_decode($this->replace_tr($string)) . ']]></g:product_type>';
							}
						}

						$output .= '  <g:quantity>' . $product['quantity'] . '</g:quantity>';
						$output .= '  <g:weight>' . $this->weight->format($product['weight'], $product['weight_class_id']) . '</g:weight>';
						$output .= '  <g:availability><![CDATA[' . ($product['quantity'] ? 'in stock' : 'out of stock') . ']]></g:availability>';
						$output .= '</item>';
					}
				}
			}

			$output .= '  </channel>';
			$output .= '</rss>';

			$this->response->addHeader('Content-Type: application/rss+xml');
			$this->response->setOutput($output);
		}
	}
	
    public function replace_tr($text) {
        $text = trim($text);
        $search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü');
        $replace = array('C','c','G','g','i','I','O','o','S','s','U','u');
        $new_text = str_replace($search,$replace,$text);
        return $new_text;
    } 

	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;
			}
		}
	}
}
Google Alışveriş iki farklı feed istiyor. Birincisi ürün feed, ikincisi yerel ürün envanter feed . Ürün feed kısmı için bu kod güzel çalışıyor. Ürün envanter feed oluştururken store code hatası veriyor. Xml içerisinde mağaza kodu sütunu bulamıyor muhtemelen. Bunu nasıl çözümleyebiliriz.

Newbie

Posts

Joined
Fri Jul 20, 2018 10:55 pm

Post by sefayama » Sat Apr 02, 2022 10:26 pm

merhaba
Google Merchant'a Feed beslemesi yüklüyorum hata veriyor. ekran görüntüsünü ekledim ne yapmam lazım bir türlü çözemedim. iyi çalışmalar.

Attachments

Ekran Resmi 2022-04-02 17.25.54.png

Ekran Resmi 2022-04-02 17.25.54.png (121.43 KiB) Viewed 8052 times


Newbie

Posts

Joined
Fri Jan 28, 2022 3:51 am

Post by kumrat » Mon Dec 26, 2022 10:30 pm

merhaba konu güncelmi

Newbie

Posts

Joined
Mon Jan 30, 2017 10:58 pm

Post by kumrat » Mon Dec 26, 2022 10:32 pm

kurulumla birlikte bu şekilde geldi

https://lemoinscher.com.tr/index.php?ro ... oogle_base

ama marcette xml hatası diyor

Newbie

Posts

Joined
Mon Jan 30, 2017 10:58 pm

Post by alikarabuyuk » Sun Sep 03, 2023 4:19 pm

Merhaba hocam opencvart da yeniyim, bahsettiğiniz dosyanın içine kodu yerleştirdim sırada ne yapmalıyız, ilk kez yapacaklar içinde açıklama yazabilirmisiniz?

Newbie

Posts

Joined
Thu Feb 23, 2023 5:43 pm
Who is online

Users browsing this forum: No registered users and 37 guests