Jump to content
Sign in to follow this  
tolys

Модуль доставки Почта России для OpenCart 1.5.5.1.2

Recommended Posts

Подскажите модуль доставки для Почты России, который высчитывает стоимость доставки. Попробовал сервис Digi-Post, скачал архивчик, залил все файлы на сайт. Всё бы ничего, настройки даже задал, зарегался, как положено, но при оформлении заказа на шаге выбора способа доставки выплывает такой текст:

Notice: Undefined property: stdClass::$parcel in /home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 66Notice: Undefined property: stdClass::$bookpost_1class in /home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 80Notice: Undefined property: stdClass::$valued_bookpost in/home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 95Notice: Undefined property: stdClass::$bookpost in/home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 109Notice: Undefined property: stdClass::$ems in/home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 123
 

Может кто-то знает, как это исправить? Или уж подкиньте модуль рабочий, буду очень благодарен  :oops:

 

Кстати, код файла digicalc.php ниже:

<?php
class ModelShippingDigiCalc extends Model {
	function getQuote($address) {
		$this->load->language('shipping/digipost');

		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('auspost_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");

		if (!$this->config->get('digipost_geo_zone_id')) {
			$status = true;
		} elseif ($query->num_rows) {
			$status = true;
		} else {
			$status = false;
		}
		$error = '';

		$quote_data = array();

		if ($status) {
			$weight = $this->weight->convert($this->cart->getWeight(), $this->config->get('config_weight_class_id'), $this->config->get('digicalc_weight_class_id'));
			
			
			if ($this->config->get('digicalc_delivery_type_ems') == 'on') {
				$ems = 1;
			} else {
				$ems = 0;
			}
			
			if ($this->config->get('digicalc_all_valued') == '1') {
				$value = $this->cart->getSubTotal();
			} else {
				$value = 0;
			}

			$region = array();
			$region['from'] = $this->config->get('digicalc_postcode');
			$region['to'] = (int)$address['postcode'];

			if (isset($region['from']) && isset($region['to'])){

				$username=$this->config->get('digipost_login');
				$password=$this->config->get('digipost_api_key');

				$url ='https://api.digi-post.ru/calc?to='.$region['to'].'&from='.$region['from'].'&weight='.$weight.'&value='.$value.'&ems='.$ems;
				
				//print_r($url);

				$process = curl_init($url);
				curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
				curl_setopt($process, CURLOPT_SSL_VERIFYHOST, false);
				curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
				curl_setopt($process, CURLOPT_TIMEOUT, 6);
				curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
				$result = curl_exec($process);
				curl_close($process);

				$Response = json_decode($result);
				
				//print_r($Response);

				if ($Response->error > 0) {
					$error = $Response->error;
				}

				if($this->cart->getSubTotal() < $this->config->get('digicalc_cost_free')) {
					if ($this->config->get('digicalc_delivery_type_parcel') && $Response->parcel) {
						$title = $Response->parcel->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->parcel->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->parcel->cost) : $Response->parcel->cost;
						$quote_data['parcel'] = array(
							'code'         => 'digicalc.parcel',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost')." руб.",
						);
					}
					if ($this->config->get('digicalc_delivery_type_bookpost_1class')  && $Response->bookpost_1class) {
						$title = $Response->bookpost_1class->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->bookpost_1class->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->bookpost_1class->cost_nds) : $Response->bookpost_1class->cost_nds;
						
						$quote_data['bookpost_1class'] = array(
							'code'         => 'digicalc.bookpost_1class',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
					if ($this->config->get('digicalc_delivery_type_valued_bookpost') && $Response->valued_bookpost) {
						$title = $Response->valued_bookpost->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->valued_bookpost->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->valued_bookpost->cost_nds) : $Response->valued_bookpost->cost_nds;
						$quote_data['valued_bookpost'] = array(
							'code'         => 'digicalc.valued_bookpost',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
					if ($this->config->get('digicalc_delivery_type_bookpost') && $Response->bookpost) {
						$title = $Response->bookpost->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->bookpost->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->bookpost->cost_simple_bookpost_cost_nds) : $Response->bookpost->cost_simple_bookpost_cost_nds;
						$quote_data['valued_bookpost'] = array(
							'code'         => 'digicalc.bookpost',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
					if ($this->config->get('digicalc_delivery_type_ems') && $Response->ems) {
						$title = $Response->ems->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->ems->eta_max . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->ems->cost) : $Response->ems->cost;
						$quote_data['cost'] = array(
							'code'         => 'digicalc.ems',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
				} else {
					$quote_data['free'] = array(
							'code'         => 'digicalc.free',
							'title'        => "Бесплатная доставка",
							'cost'         => 0,
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => "бесплатно"
						);
				}

			} // isset from and to

		} //status

		$method_data = array();

		if ($quote_data) {
			$method_data = array(
				'code'       => 'digicalc',
				'title'      => $this->language->get('text_title'),
				'quote'      => $quote_data,
				'sort_order' => $this->config->get('digicalc_sort_order'),
				'error'      => $error
			);
		}

		return $method_data;

	}
}
?>
Edited by afwollis

Share this post


Link to post
Share on other sites

Попробовал сервис Digi-Post, скачал архивчик, залил все файлы на сайт.

где что скачал?

Share this post


Link to post
Share on other sites

последний раз спрашиваю - где и что ты скачал?

Share this post


Link to post
Share on other sites
В 14.12.2015 в 13:37, tolys сказал:

Подскажите модуль доставки для Почты России, который высчитывает стоимость доставки. Попробовал сервис Digi-Post, скачал архивчик, залил все файлы на сайт. Всё бы ничего, настройки даже задал, зарегался, как положено, но при оформлении заказа на шаге выбора способа доставки выплывает такой текст:

 


Notice: Undefined property: stdClass::$parcel in /home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 66Notice: Undefined property: stdClass::$bookpost_1class in /home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 80Notice: Undefined property: stdClass::$valued_bookpost in/home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 95Notice: Undefined property: stdClass::$bookpost in/home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 109Notice: Undefined property: stdClass::$ems in/home/t/tolysi1u/***.ru/public_html/catalog/model/shipping/digicalc.php on line 123

 

Может кто-то знает, как это исправить? Или уж подкиньте модуль рабочий, буду очень благодарен  :oops:

 

Кстати, код файла digicalc.php ниже:

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

 



<?php
class ModelShippingDigiCalc extends Model {
	function getQuote($address) {
		$this->load->language('shipping/digipost');

		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('auspost_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");

		if (!$this->config->get('digipost_geo_zone_id')) {
			$status = true;
		} elseif ($query->num_rows) {
			$status = true;
		} else {
			$status = false;
		}
		$error = '';

		$quote_data = array();

		if ($status) {
			$weight = $this->weight->convert($this->cart->getWeight(), $this->config->get('config_weight_class_id'), $this->config->get('digicalc_weight_class_id'));
			
			
			if ($this->config->get('digicalc_delivery_type_ems') == 'on') {
				$ems = 1;
			} else {
				$ems = 0;
			}
			
			if ($this->config->get('digicalc_all_valued') == '1') {
				$value = $this->cart->getSubTotal();
			} else {
				$value = 0;
			}

			$region = array();
			$region['from'] = $this->config->get('digicalc_postcode');
			$region['to'] = (int)$address['postcode'];

			if (isset($region['from']) && isset($region['to'])){

				$username=$this->config->get('digipost_login');
				$password=$this->config->get('digipost_api_key');

				$url ='https://api.digi-post.ru/calc?to='.$region['to'].'&from='.$region['from'].'&weight='.$weight.'&value='.$value.'&ems='.$ems;
				
				//print_r($url);

				$process = curl_init($url);
				curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
				curl_setopt($process, CURLOPT_SSL_VERIFYHOST, false);
				curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
				curl_setopt($process, CURLOPT_TIMEOUT, 6);
				curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
				$result = curl_exec($process);
				curl_close($process);

				$Response = json_decode($result);
				
				//print_r($Response);

				if ($Response->error > 0) {
					$error = $Response->error;
				}

				if($this->cart->getSubTotal() < $this->config->get('digicalc_cost_free')) {
					if ($this->config->get('digicalc_delivery_type_parcel') && $Response->parcel) {
						$title = $Response->parcel->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->parcel->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->parcel->cost) : $Response->parcel->cost;
						$quote_data['parcel'] = array(
							'code'         => 'digicalc.parcel',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost')." руб.",
						);
					}
					if ($this->config->get('digicalc_delivery_type_bookpost_1class')  && $Response->bookpost_1class) {
						$title = $Response->bookpost_1class->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->bookpost_1class->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->bookpost_1class->cost_nds) : $Response->bookpost_1class->cost_nds;
						
						$quote_data['bookpost_1class'] = array(
							'code'         => 'digicalc.bookpost_1class',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
					if ($this->config->get('digicalc_delivery_type_valued_bookpost') && $Response->valued_bookpost) {
						$title = $Response->valued_bookpost->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->valued_bookpost->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->valued_bookpost->cost_nds) : $Response->valued_bookpost->cost_nds;
						$quote_data['valued_bookpost'] = array(
							'code'         => 'digicalc.valued_bookpost',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
					if ($this->config->get('digicalc_delivery_type_bookpost') && $Response->bookpost) {
						$title = $Response->bookpost->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->bookpost->eta . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->bookpost->cost_simple_bookpost_cost_nds) : $Response->bookpost->cost_simple_bookpost_cost_nds;
						$quote_data['valued_bookpost'] = array(
							'code'         => 'digicalc.bookpost',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
					if ($this->config->get('digicalc_delivery_type_ems') && $Response->ems) {
						$title = $Response->ems->type;
						if ($this->config->get('digicalc_display_time')) {
							$title .= ' (' . $Response->ems->eta_max . ' ' . $this->language->get('text_eta') . ')';
						}
						$cost = $this->config->get('digicalc_round_summ') ? round($Response->ems->cost) : $Response->ems->cost;
						$quote_data['cost'] = array(
							'code'         => 'digicalc.ems',
							'title'        => $title,
							'cost'         => $cost + $this->config->get('digicalc_addcost'),
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => $cost + $this->config->get('digicalc_addcost'). " руб."
						);
					}
				} else {
					$quote_data['free'] = array(
							'code'         => 'digicalc.free',
							'title'        => "Бесплатная доставка",
							'cost'         => 0,
							'tax_class_id' => $this->config->get('digicalc_tax_class_id'),
							'text'         => "бесплатно"
						);
				}

			} // isset from and to

		} //status

		$method_data = array();

		if ($quote_data) {
			$method_data = array(
				'code'       => 'digicalc',
				'title'      => $this->language->get('text_title'),
				'quote'      => $quote_data,
				'sort_order' => $this->config->get('digicalc_sort_order'),
				'error'      => $error
			);
		}

		return $method_data;

	}
}
?>

Добрый день. Нашли решение своей ошибки? Столкнулся с такой же.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.