dimon7772
Профессор
- Регистрация
- 30 Апр 2013
- Сообщения
- 171
- Реакции
- 41
- Автор темы
- #1
Появилась задача вывести в личном кабинете общую сумму покупок и текущий процент скидки.
Как я понимаю, нужно вытащить из модуля (shoputils_cumulative_discounts_.tpl) переменные и вставить в шаблон account.tpl
	
	
		
			
	
	
	
		
		
	
Но выдаёт ошибки, как понимаю, надо из контролёра модуля скопировать какой-то кусок кода.
	
	
		
			
	
	
	
		
		
	
Вопрос №1. Какой участок брать?
Вопрос №2. Этот кусок надо вставить в account.php?
Кто может подсказать?
	
		
			
		
		
	
				
			Как я понимаю, нужно вытащить из модуля (shoputils_cumulative_discounts_.tpl) переменные и вставить в шаблон account.tpl
		PHP:
	
	<?php echo $text_customer; ?><br/><br/>
            <?php if (isset($text_cumulative_summ)) { ?>
                <?php echo $text_cumulative_summ; ?><br/><br/>
            <?php } ?>
            <?php echo $text_description; ?><br/><br/>
            <a href="<?php echo $href_discounts; ?>"><?php echo $text_href_discounts; ?></a>
		PHP:
	
	class ControllerModuleShoputilscumulativediscounts extends Controller {
    public function discounts() {
        $this->load->model('total/shoputils_cumulative_discounts');
        $this->language->load('module/shoputils_cumulative_discounts_');
        $this->data['breadcrumbs'] = array();
        $this->document->setTitle($this->language->get('heading_full_title'));
        $this->data['heading_title'] = $this->language->get('heading_full_title');
         $this->data['breadcrumbs'][] = array(
            'href'      => HTTP_SERVER . 'index.php?route=common/home',
            'text'      => $this->language->get('text_home'),
            'separator' => $this->language->get('text_separator')
        );
         $this->data['breadcrumbs'][] = array(
           'href'      => HTTP_SERVER . 'index.php?route=module/shoputils_cumulative_discounts_/discounts',
           'text'      => $this->language->get('heading_title'),
           'separator' => FALSE
        );
        $cmsdata = $this->data['discounts'] = $this->model_total_shoputils_cumulative_discounts->getDiscountsCMSData(
            (int)$this->config->get('config_language_id')
        );
        $this->data['description_before'] = htmlspecialchars_decode($cmsdata['description_before']);
        $this->data['description_after'] = htmlspecialchars_decode($cmsdata['description_after']);
        $this->data['discounts'] =$this->model_total_shoputils_cumulative_discounts->getDiscounts(
            (int)$this->config->get('config_store_id'),
            (int)$this->config->get('config_customer_group_id'),
            (int)$this->config->get('config_language_id')
        );
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/shoputils_cumulative_discounts_list.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/shoputils_cumulative_discounts_list.tpl';
        } else {
            $this->template = 'default/template/module/shoputils_cumulative_discounts_list.tpl';
        }
        $this->children = array(
            'common/header',
            'common/footer',
            'common/column_left',
            'common/column_right'
        );
        $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
    }
    protected function index() {
        $this->id = 'shoputils_cumulative_discounts_';
        if ($this->customer->isLogged()){
            $this->load->model('total/shoputils_cumulative_discounts');
            $this->language->load('module/shoputils_cumulative_discounts_');
            $this->data['heading_title'] = $this->language->get('heading_title');
            $this->data['text_customer'] = $this->customer->getFirstname() . ' ' . $this->customer->getLastname();
            $this->data['href_discounts'] = HTTP_SERVER.'index.php?route=module/shoputils_cumulative_discounts_/discounts';
            if ($discount = $this->model_total_shoputils_cumulative_discounts->getLoggedCustomerDiscount() ){
                if ($discount['description']){
                    $this->data['text_description'] = $discount['description'];
                } else {
                    $this->data['text_description'] =  $this->language->get('text_description_empty');
                }
                $this->data['text_href_discounts'] = $this->language->get('text_href_discounts_logged');
                $this->data['text_cumulative_summ'] = sprintf($this->language->get('text_cumulative_summ'), $this->currency->format($discount['cumulative_summ']));
            } else {
                $this->data['text_description'] = $this->language->get('text_description_none');;
                $this->data['text_href_discounts'] = $this->language->get('text_href_discounts_not_logged');
            }
            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/shoputils_cumulative_discounts_.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/module/shoputils_cumulative_discounts_.tpl';
            } else {
                $this->template = 'default/template/module/shoputils_cumulative_discounts_.tpl';
            }
            $this->render();
        }
    }
}
?>Вопрос №1. Какой участок брать?
Вопрос №2. Этот кусок надо вставить в account.php?
Кто может подсказать?
			
				Последнее редактирование: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
				 
 
		