Jump to content
Sign in to follow this  
worstman

Исправить работу калькулятора стоимости почты postcalc.ru

Recommended Posts

Работал у нас калькулятор стоимости почты

Содержимое контроллера

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

        $query = $this->db->query("SELECT name FROM " . DB_PREFIX . "zone WHERE zone_id = " . (int)$address['zone_id'] . " AND country_id = " . (int)$address['country_id']);


		if ($query->num_rows) {
			$status = true;
		} else {
			$status = false;
		}

		$method_data = array();

		if ($status) {

            $region = array();
            $region['from'] = $this->config->get('pochtaros_zone');
			$region['to'] = $query->rows[0]['name'];

		    $this->load->model('localisation/zone_dv');
			$region = $this->model_localisation_zone_dv->getZone($region);

	          if ($region){
	          	$from=urlencode($region['from']);
	            $to=urlencode($region['to']);
	            $weight=$this->cart->getWeight();
	            $ocen=$this->cart->getSubTotal();

	            $Request='http://api.postcalc.ru/?f='.$from.'&t='.$to.'&w='.$weight.'&v='.$ocen.'&o=php&e=0&Site=DOMAINWASHERE&Email='.rawurlencode('EMAILWASHERE').'&Person=NAMEWASHERE&cs=Windows-1251';
				$Response=file_get_contents($Request);
				if ( substr($Response,0,3) == "\x1f\x8b\x08" ) $Response=gzinflate(substr($Response,10,-8));
			    $arrResponse = unserialize($Response);
			    $price=floor($arrResponse['Отправления']['ЦеннаяПосылка']['Доставка']);
	          }

            if(isset($price)){
				$cost = $this->config->get('pochtaros_cost')+$price;
				$text = $this->currency->format($this->tax->calculate($cost,'', $this->config->get('config_tax')));
            }else{
            	$cost = '';
            	$text = '';
            }

			$quote_data = array();

      		$quote_data['pochtaros'] = array(
        		'code'         => 'pochtaros.pochtaros',
        		'title'        => $this->language->get('text_description'),
        		'cost'         => $cost,
        		'tax_class_id' => '',
				'text'         => $text
      		);

      		$method_data = array(
        		'code'       => 'pochtaros',
        		'title'      => $this->config->get('pochtaros_name'),
        		'quote'      => $quote_data,
				'sort_order' => $this->config->get('pochtaros_sort_order'),
        		'error'      => false
      		);
		}

		return $method_data;
	}
}
?>

После накатки модуля ЕМS регионы стали вот такими https://yadi.sk/i/Oy6MdthDh9dhJ

Хотя перезаписи файлов не было, вроде.

 

Раньше были вот такими - https://yadi.sk/i/XaN8SiY-h9doK

 

ЕМS расчитывается, но почта перестала.

Edited by afwollis
removed personal data

Share this post


Link to post
Share on other sites

1. это модель.

2. убрал из кода информацию о домене, email, фио

3. а после "откатки" EMS в норму пришло?

Share this post


Link to post
Share on other sites

1. Да, наверное.

2. Спасибо

3. Удалить файлы аплоада? но нам и емс тоже нужен.

Share this post


Link to post
Share on other sites

попробовал откллючит модуль и удалить файлы - не помогло

регионы по прежнему капсом

Share this post


Link to post
Share on other sites

судя по всему сервер почему то не отправляет запросы вообще

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.