Post by toothless3010 » Mon Mar 05, 2018 4:28 pm

Hi there, Im a newbie getting used to Opencart environment. I need help with product bands as I have attached in picture below.
I need the coming_soon option to overwrite the out_of_stock option settings. Its not working correctly as Im confused with the logic that has been made. Out_of_stock option works when there is only "0" quantity products. When we have a new product that is Coming_soon we would make that product quantity "0" as well but something is wrong here and the Coming_soon is not overwriting the Out_of_stock setting. I need some help here.


catalog/controller/product/category.php

Code: Select all

/*OOS Band start*/
				$optionsQty = 0;
				$oosQty = 0;
				foreach ($this->model_catalog_product->getProductOptions($result['product_id']) as $option) {
					if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
						foreach ($option['option_value'] as $option_value) {
							$optionsQty++;
							if ($option_value['quantity'] <=0) $oosQty++; 
						}
					}
				}
				if ($optionsQty == $oosQty && $optionsQty > 0 ) {
				$band_oos = true;
				}
				else $band_oos = false;
/*OOS Band end*/

catalog/view/product/category.tpl

Code: Select all

<div class="for_infine">
								<?php if ($product['band_oos']) { ?>
									<span class="band-oos">&nbsp;</span>
								<?php } ?>
								<?php if ($product['band_free_shipping'] == 'Yes') { ?>
									<span class="band-free-shipping">&nbsp;</span>
								<?php } ?>
								
								<?php if ($product['band_new'] == 'Yes') { ?>
									<span class="band-new">&nbsp;</span>
								<?php } ?>
                                
                                <?php if ($product['band_coming_soon'] == 'Yes') { ?>
									<span class="band-coming-soon">&nbsp;</span>
								<?php } ?>
								<br />
catalog/controller/product/product.php

Code: Select all

$this->data['options'] = array();
			
			$optionsQty = 0;
			$oosQty = 0;
			foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) { 
				if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') { 
					$option_value_data = array();
					
					foreach ($option['option_value'] as $option_value) {
						$optionsQty++;
						if ($option_value['quantity'] <=0) $oosQty++; 
						
						if ((float)$product_info['special']) {
							$price_original = $product_info['special'];
						}else {
							$price_original = $product_info['price'];

						}

catalog/view/product/product.tpl

Code: Select all

<div class="left">
            <div class="heading" style="line-height: 27px; font-size: 25px;"><?php echo $heading_title; ?></div>
		        <?php if ($thumb) { ?>
		        <div class="image">


              <?php if ($band_oos ) { ?>
                <div class="oos_tab_large top-right-cnr"></div>
              <?php } ?>
		      		<?php if ($band_free_shipping == 'Yes') { ?>
						  <div class="free_shipping_tab_large top-right-cnr"></div>
			     	  <?php } ?>
		      		<?php if ($band_new == 'Yes') { ?>
						  <div class="new_tab_large top-right-cnr"></div>
					   <?php } ?>
              <?php if ($band_coming_soon == 'Yes') { ?>
              <div class="coming_soon_tab_large top-right-cnr"></div>
              <?php } ?>

Attachments

Product page out of stock band.jpg

Product out_of_stock bamd - Product page out of stock band.jpg (236.57 KiB) Viewed 680 times

Coming_soon admin quantity.jpg

Product quantity - Coming_soon admin quantity.jpg (154.2 KiB) Viewed 680 times

Coming_soon admin.jpg

Coming_soon checkbox - Coming_soon admin.jpg (141.03 KiB) Viewed 680 times


Newbie

Posts

Joined
Tue Sep 05, 2017 5:02 pm

Post by straightlight » Mon Mar 05, 2018 8:05 pm

No OC version posted.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by toothless3010 » Tue Mar 06, 2018 1:12 am

Sorry sir, i thought its the OC 1.5 General Support group. So i assume all knew. Its 1.5.51.

Newbie

Posts

Joined
Tue Sep 05, 2017 5:02 pm

Post by IP_CAM » Tue Mar 06, 2018 11:15 am

Well, there where 24 OC 1.5-x Subversions, from 1.5.0 - 1.5.6.5_rc,
so, it's quite not as easy, as you figured... :D
https://github.com/halfhope/OpenCart-all-versions

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by toothless3010 » Tue Mar 06, 2018 11:16 am

sorry big boss. my mistake. wont repeat again.

Newbie

Posts

Joined
Tue Sep 05, 2017 5:02 pm
Who is online

Users browsing this forum: No registered users and 201 guests