Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Могдельный ряд для товаров, как догделать?


Recommended Posts

Добрый гдень, у меня есть проект в рилите, клиент попросил пригделать к товарам, могдельный ряд, к примеру товар

Кондиционер сплит-система Cooper&Hunter CH-S09FTXW

CH-S09FTXW - у нас выступает в качестве могдели и иких могделей может быть несколько,( CH-S07FTXW, CH-S18FTXW ) они относятся к одной серии.

И вот как это отображается на сайте

Спойлер

9434936_.png.1dca5984923b4c97608ea148a0ebb49e.png

 

По сути это тоже товары, Мне надо, что бы товары которые уже вписаны в могдельном ряду какого-то из продуктов, не отображались в списке товаров. Как это сгделать, я не могу пока предсивить. Вот собственно пример. У нас есть товар Кондиционер сплит-система Cooper&Hunter CH-S09FTXW и у него есть могдельный ряд, и товар Кондиционер сплит-система Cooper&Hunter CH-S07FTXW из могдельного ряда, в списке товаров, не отображался

 

В контроллере эи штука вот ик собирается

Спойлер
	$results = $this->model_catalog_product->getProducts($filter_data);
			
			$this->load->model('catalog/review');
			foreach ($results as $result) {				
				if ($result['image']) {
					$image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				} else {
					$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				}

				if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
					$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$price = false;
				}

				if ((float)$result['special']) {
					$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$special = false;
				}

				if ($this->config->get('config_tax')) {
					$tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']);
				} else {
					$tax = false;
				}

				if ($this->config->get('config_review_status')) {
					$rating = (int)$result['rating'];
				} else {
					$rating = false;
				}
				if ($result['minimum']) {
					$minimum = $result['minimum'];
				} else {
					$minimum  = 1;
				}
				// получаем могдели которые односятся к даному товару
				$series_products = $this->model_catalog_product->getSeries($result['product_id']);
				$series = array();
				if($series_products){
					foreach($series_products as $series_product) {
						if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
							$price_s = $this->currency->format($this->tax->calculate($series_product['price'], $series_product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
						} else {
							$price_s = false;
						}
		
		
						if ((float)$series_product['special']) {
							$special_s = $this->currency->format($this->tax->calculate($series_product['special'], $series_product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
						} else {
							$special_s = false;
						}
		
						$series[] = array(
							'product_id'  => $series_product['product_id'],
							'name'        => $series_product['jan'],
							'price'       => $price_s,
							'special'     => $special_s,
							'm2'			=> $series_product['upc'],
							'href'        => $this->url->link('product/product', 'product_id=' . $series_product['product_id'], true),
						);
					} 
				}
				
			// записываем в масив инфу о продуких
				$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'series'  => $series,
					'stiker'  => $result['ean'],
					'quantity' => $result['quantity'],				
					'series'  => $series,
					'thumb'       => $image,
					'name'        => $result['name'],
					'id_item'	  =>"itemcatalog" . $result['product_id'],
					'minimum'	=> $minimum,
					'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'attribute_groups'	=> $this->model_catalog_product->getProductAttributes($result['product_id']),
					'tax'         => $tax,
					'total_review' => sprintf($this->language->get('text_total_r'), $this->model_catalog_review->getTotalReviewsByProductId( $result['product_id'])),
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
				);

				
			}

 

Скорей всего надо его фильтровать еещё в могдели, в функции getProducts

Link to comment
Share on other sites


  • 4 weeks later...
В 31.08.2021 в 15:06, Kingfrelance сказал:

Добрый гдень, у меня есть проект в рилите, клиент попросил пригделать к товарам, могдельный ряд, к примеру товар

Кондиционер сплит-система Cooper&Hunter CH-S09FTXW

CH-S09FTXW - у нас выступает в качестве могдели и иких могделей может быть несколько,( CH-S07FTXW, CH-S18FTXW ) они относятся к одной серии.

И вот как это отображается на сайте

  Показать контент

9434936_.png.1dca5984923b4c97608ea148a0ebb49e.png

 

По сути это тоже товары, Мне надо, что бы товары которые уже вписаны в могдельном ряду какого-то из продуктов, не отображались в списке товаров. Как это сгделать, я не могу пока предсивить. Вот собственно пример. У нас есть товар Кондиционер сплит-система Cooper&Hunter CH-S09FTXW и у него есть могдельный ряд, и товар Кондиционер сплит-система Cooper&Hunter CH-S07FTXW из могдельного ряда, в списке товаров, не отображался

 

В контроллере эи штука вот ик собирается

  Показать контент

	$results = $this->model_catalog_product->getProducts($filter_data);
			
			$this->load->model('catalog/review');
			foreach ($results as $result) {				
				if ($result['image']) {
					$image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				} else {
					$image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height'));
				}

				if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
					$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$price = false;
				}

				if ((float)$result['special']) {
					$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else {
					$special = false;
				}

				if ($this->config->get('config_tax')) {
					$tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']);
				} else {
					$tax = false;
				}

				if ($this->config->get('config_review_status')) {
					$rating = (int)$result['rating'];
				} else {
					$rating = false;
				}
				if ($result['minimum']) {
					$minimum = $result['minimum'];
				} else {
					$minimum  = 1;
				}
				// получаем могдели которые односятся к даному товару
				$series_products = $this->model_catalog_product->getSeries($result['product_id']);
				$series = array();
				if($series_products){
					foreach($series_products as $series_product) {
						if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
							$price_s = $this->currency->format($this->tax->calculate($series_product['price'], $series_product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
						} else {
							$price_s = false;
						}
		
		
						if ((float)$series_product['special']) {
							$special_s = $this->currency->format($this->tax->calculate($series_product['special'], $series_product['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
						} else {
							$special_s = false;
						}
		
						$series[] = array(
							'product_id'  => $series_product['product_id'],
							'name'        => $series_product['jan'],
							'price'       => $price_s,
							'special'     => $special_s,
							'm2'			=> $series_product['upc'],
							'href'        => $this->url->link('product/product', 'product_id=' . $series_product['product_id'], true),
						);
					} 
				}
				
			// записываем в масив инфу о продуких
				$data['products'][] = array(
					'product_id'  => $result['product_id'],
					'series'  => $series,
					'stiker'  => $result['ean'],
					'quantity' => $result['quantity'],				
					'series'  => $series,
					'thumb'       => $image,
					'name'        => $result['name'],
					'id_item'	  =>"itemcatalog" . $result['product_id'],
					'minimum'	=> $minimum,
					'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
					'price'       => $price,
					'special'     => $special,
					'attribute_groups'	=> $this->model_catalog_product->getProductAttributes($result['product_id']),
					'tax'         => $tax,
					'total_review' => sprintf($this->language->get('text_total_r'), $this->model_catalog_review->getTotalReviewsByProductId( $result['product_id'])),
					'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
					'rating'      => $result['rating'],
					'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
				);

				
			}

 

Скорей всего надо его фильтровать еещё в могдели, в функции getProducts

Добрый гдень, столкнулся с подобной ситуацией...погделитесь как Вы нашли решение этот ситуации

Link to comment
Share on other sites


3 часа назад, 2b3 сказал:

Добрый гдень, столкнулся с подобной ситуацией...погделитесь как Вы нашли решение этот ситуации

Мне догделали, дописав функцию

   
    public function seriesPush($product_id, $existing_series){
        $series_list = $this->getSeries($product_id);
        foreach($series_list as $series){
            $existing_series[str_replace(' ', '', $series['jan'])] = str_replace(' ', '', $series['jan']);
        }
        return $existing_series;
    }
    
    

 

  • +1 1
Link to comment
Share on other sites


извините что беспокою, я в opencarte еещё совсем новичек...не могли бы вы за финансовое спасипотому что помочь мне с внедрением в сайт аналогичного модуля, у меня тоже тематика конгдеи и аналогичная ситуация...Человек попросил сгделать сайт вот по этому образцу https://vipklimat.com.ua/

Link to comment
Share on other sites


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

×
×
  • 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.