Post by bonyta2442 » Tue Oct 06, 2020 4:09 pm

Hi all,
Can somebody help displaying the MOQ message like on the product page but in the Fast Order Form?
I have take the code from product.tpl and php andplaced into
fastorder.tpl:

Code: Select all

						<?php if ($minimum > 1) { ?>
						<div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_minimum; ?></div>
						<?php } ?>
Language:

Code: Select all

$_['text_minimum']      = 'This product has Minimum Order Quantity: %s';
controller from the product.php to fastorder.php:

Code: Select all

$data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product_info['minimum']);
and

Code: Select all

if ($product_info['minimum']) {
				$data['minimum'] = $product_info['minimum'];
			} else {
				$data['minimum'] = 1;
			}
... ???
How can I get the $product_info['minimum'] value?
OC: 2.0.1.1
Last edited by bonyta2442 on Fri Oct 09, 2020 3:20 pm, edited 2 times in total.

https://www.dbkdimitrov.com
https://www.tuningcenterbg.com
https://www.samozamen.com
https://www.h-r.bg


Newbie

Posts

Joined
Sun Aug 19, 2018 12:30 pm


Post by OSWorX » Tue Oct 06, 2020 5:12 pm

bonyta2442 wrote:
Tue Oct 06, 2020 4:09 pm
How can I get the $product_info['minimum'] value?
You have it already in the controller - what do you want more?

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by bonyta2442 » Thu Oct 08, 2020 2:50 pm

2020-10-08 9:24:07 - PHP Notice: Undefined variable: product_info in /home/dbkdu3lq/autoclips.bg/catalog/controller/product/fastorder.php on line 67
2020-10-08 9:24:10 - PHP Notice: Undefined variable: product_info in /home/dbkdu3lq/autoclips.bg/catalog/controller/product/fastorder.php on line 186
2020-10-08 9:24:10 - PHP Notice: Undefined variable: product_info in /home/dbkdu3lq/autoclips.bg/catalog/controller/product/fastorder.php on line 187
the fastorder.php is:

Code: Select all

public function index($data) {
        // Debugging
        if($this->dev){
            // Write message if developer version is enable.
            echo '<div style="margin:0px; width:100%; text-align: right; padding:0 10px; font-weight:bold; color:#c53d36">This is developer version (FastOrder)!</div>';
        }

        // If page not found - do not show button
        if(empty($data['name'])){
            return false;
        }

        // If Display stock is enable and out of stock is disbale - do not show fastorder button
        if ( $this->config->get('config_stock_display')
                and !$this->config->get('config_stock_checkout')
                and $this->model_catalog_product->getProduct($data['product_id'])['quantity'] < 1
            ) {
            return false;
        }
		
	 // Load lanuage
        $this->load->language('product/fastorder');

        // Language data - i have clear the rest and leav only the minimum
       
       //minimum
		$data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product_info['minimum']);
				

        // If special price is set - display it
        if(isset($data['special'])){
          $data['price'] = $data['special'];
        }else{
			$special = false;
        }
				
        if(!isset($data['price'])){
          $data['price'] = $data['txt_none_price'];
        }

        if($this->config->get('config_template')) {
            $template = $this->config->get('config_template');
        }else{
            $template = 'default';
        }
						
        // Need before rewrite module (hack)
        $data['product_name'] = $data['name'];	

        // Get the product link
        //if (isset($this->request->server['REQUEST_SCHEME'])) {
        //    $data['product_link'] = $this->request->server['REQUEST_SCHEME'].'://' . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];
        // }else{
        //    $data['product_link'] = 'http://' . $this->request->server['HTTP_HOST'] . $this->request->server['REQUEST_URI'];
        // }

        // Get the product link
        if (isset($this->request->get['path'])) {
           $path = 'path=' . $this->request->get['path'];
        }else{
            $path = 'route=' . $this->request->get['route'];
        }

        $data['product_link'] = $this->url->link('product/product', $path . '&product_id=' . $data['product_id']);

        // FastOrder price var
        $data['price'] = $this->currency->format($this->tax->calculate($data['price'], $data['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'],'',false);

        // FastOrder special price var
        if($data['special']){
            $fo_special = $this->currency->format($this->tax->calculate($data['special'], $data['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency'],'',false);
        }else{
            $fo_special = null;
        }
        $this->document->addStyle('catalog/view/theme/'. $template.'/stylesheet/fastorder.css');
        if(VERSION >= '2.2.0.0') {
          return $this->load->view('product/fastorder', $data);
        }else{
          return $this->load->view($this->config->get('config_template') . '/template/product/fastorder.tpl', $data);
        }
    }

https://www.dbkdimitrov.com
https://www.tuningcenterbg.com
https://www.samozamen.com
https://www.h-r.bg


Newbie

Posts

Joined
Sun Aug 19, 2018 12:30 pm


Post by OSWorX » Thu Oct 08, 2020 5:08 pm

As I can read, you have created a "clone" of the product.php controller and named it fastorder.php - correct?
Where do you have in your new controller this:

Code: Select all

$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product_id);
If you have already, then you have your minimum.
If not, add it.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by bonyta2442 » Thu Oct 08, 2020 5:36 pm

I have try this too but then i receive:
2020-10-08 12:32:39 - PHP Notice: Undefined variable: product_id in /home/dbkdu3lq/autoclips.bg/catalog/controller/product/fastorder.php on line 209

Code: Select all

//minimum
		
		$this->load->model('catalog/product');
		$product_info = $this->model_catalog_product->getProduct($product_id);
		
		$data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product_info['minimum']);
		
				
		if ($product_info['minimum']) {
				$data['minimum'] = $product_info['minimum'];
			} else {
				$data['minimum'] = 1;
			}
				
		// end minimum
No this was free module fast order. But I need to display in the form that the product have moq
https://www.autoclips.bg/копка-щипка-14 ... meo-166-40

https://www.dbkdimitrov.com
https://www.tuningcenterbg.com
https://www.samozamen.com
https://www.h-r.bg


Newbie

Posts

Joined
Sun Aug 19, 2018 12:30 pm


Post by bonyta2442 » Thu Oct 08, 2020 6:11 pm

I made it! :)

Code: Select all

//minimum
		
		$this->load->model('catalog/product');
		
		if (isset($this->request->post['product_id'])){
          $json['product_id'] = $this->request->post['product_id'];
        }
		
		$product_id = $json['product_id'];
				
		$product_info = $this->model_catalog_product->getProduct($product_id);
		
		$data['text_minimum'] = sprintf($this->language->get('text_minimum'), $product_info['minimum']);
		
				
		if ($product_info['minimum']) {
				$data['minimum'] = $product_info['minimum'];
			} else {
				$data['minimum'] = 1;
			}
				
		// end minimum

https://www.dbkdimitrov.com
https://www.tuningcenterbg.com
https://www.samozamen.com
https://www.h-r.bg


Newbie

Posts

Joined
Sun Aug 19, 2018 12:30 pm


Post by OSWorX » Thu Oct 08, 2020 6:14 pm

bonyta2442 wrote:
Thu Oct 08, 2020 6:11 pm
I made it! :)
Even a blind will find sometimes a grain .. O0
If done and working, please edit your 1st post and add [SOLVED] in front of the title.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 46 guests