Post by madmatt » Wed Feb 24, 2016 4:39 pm

Hi

Can anyone please help me change this file so it will work with 2.0.3.1

thanks

Code: Select all

<modification>
	<id><![CDATA[@tik Remove Add to Cart button for Out of Stock items]]></id>
	<version><![CDATA[1.4.1]]></version>
	<vqmver><![CDATA[2.4.1]]></vqmver>
	<author><![CDATA[OC2PS]]></author>
	
	<file name="catalog/view/theme/*/template/product/product.tpl">
		<operation>
			<search position="replace"><![CDATA[<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />]]></search>
			<add><![CDATA[<?php if ($stock_qty <= 0) {
echo "<span style=\"color: red; font-size: 16px;\"><span class=\"outofstock\">" . $stock_status . "</span></span>";
} else { 
echo "<input type=\"button\" value=\"" . $button_cart . "\" id=\"button-cart\" class=\"button\" />";
} ?>]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA[<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><?php echo $button_cart; ?></a>]]></search>
			<add><![CDATA[<?php if ($stock_qty <= 0) {
echo "<span style=\"color: red; font-size: 16px;\"><span class=\"outofstock\">" . $stock_status . "</span></span>";
} else { 
echo "<a onclick=\"addToCart('" . $product['product_id'] . "');\" class=\"button\">" . $button_cart . "</a>";
} ?>]]></add>
		</operation>		
	</file>
	
	<file name="catalog/controller/product/product.php">
		<operation>
			<search position="after" offset="6"><![CDATA[if ($product_info['quantity'] <= 0) {]]></search>
			<add><![CDATA[$this->data['stock_status'] = $product_info['stock_status'];
$this->data['stock_qty'] = $product_info['quantity'];]]></add>
		</operation>
	</file>
	
	<file path="catalog/controller/product/" name="category.php,manufacturer.php,search.php,special.php">
		<operation>
			<search position="replace" error="skip"><![CDATA[$this->data['products'][] = array(]]></search>
			<add><![CDATA[$stock_status = $result['stock_status'];
$stock_qty = $result['quantity'];

$this->data['products'][] = array(
'stock_status'       => $stock_status,
'stock_qty'       => $stock_qty,
]]></add>
		</operation>
	</file>
	
	<file path="catalog/controller/module/" name="bestseller.php,featured.php,latest.php,special.php,wishlist.php">
		<operation>
			<search position="replace" error="skip"><![CDATA[$this->data['products'][] = array(]]></search>
			<add><![CDATA[$stock_status = $product_info['stock_status'];
$stock_qty = $product_info['quantity'];

$this->data['products'][] = array(
'stock_status'       => $stock_status,
'stock_qty'       => $stock_qty,]]></add>
		</operation>		
	</file>
	
	<file path="catalog/controller/account/" name="wishlist.php">
		<operation>
			<search position="replace" error="skip"><![CDATA[$this->data['products'][] = array(]]></search>
			<add><![CDATA[$stock_status = $product_info['stock_status'];
$stock_qty = $product_info['quantity'];

$this->data['products'][] = array(
'stock_status'       => $stock_status,
'stock_qty'       => $stock_qty,]]></add>
		</operation>		
	</file>
	
	<file name="catalog/controller/product/compare.php">
		<operation>
			<search position="after" offset="6" error="skip"><![CDATA[if ($product_info['quantity'] <= 0) {]]></search>
			<add><![CDATA[$stock_status = $product_info['stock_status'];
$stock_qty = $product_info['quantity'];]]></add>
		</operation>
		<operation>
			<search position="replace" error="skip"><![CDATA[$this->data['products'][$product_id] = array(]]></search>
			<add><![CDATA[$this->data['products'][$product_id] = array(
			'stock_status'       => $stock_status,
'stock_qty'       => $stock_qty,]]></add>
		</operation>
	</file>
	
	<file path="catalog/view/theme/*/template/product/" name="category.tpl,compare.tpl,manufacturer_info.tpl,search.tpl,special.tpl">
		<operation>
			<search position="replace" error="skip"><![CDATA[<input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />]]></search>
			<add><![CDATA[<?php 
if ($product['stock_qty'] <= 0) { 
echo "<span style=\"color: red; font-size: 16px;\"><span class=\"outofstock\">" . $product['stock_status'] . "</span></span>";
} else { 
echo "<input type=\"button\" value=\"" . $button_cart . "\" onclick=\"addToCart('" . $product['product_id'] . "');\" class=\"button\" />";
} 
?>
]]></add>
		</operation>
	</file>
	
	<file path="catalog/view/theme/*/template/module/" name="bestseller.tpl,featured.tpl,latest.tpl,special.tpl">
		<operation>
			<search position="replace" error="skip"><![CDATA[<input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />]]></search>
			<add><![CDATA[<?php 
if ($product['stock_qty'] <= 0) { 
echo "<span style=\"color: red; font-size: 16px;\"><span class=\"outofstock\">" . $product['stock_status'] . "</span></span>";
} else { 
echo "<input type=\"button\" value=\"" . $button_cart . "\" onclick=\"addToCart('" . $product['product_id'] . "');\" class=\"button\" />";
} 
?>
]]></add>
		</operation>
	</file>
	
	<file name="catalog/view/theme/*/template/account/wishlist.tpl">
		<operation>
			<search position="replace" error="skip"><![CDATA[<img src="catalog/view/theme/default/image/cart-add.png" alt="<?php echo $button_cart; ?>" title="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" />]]></search>
			<add><![CDATA[<?php 
if ($product['stock_qty'] <= 0) { 
echo "<span style=\"color: red; font-size: 10px;\"><span class=\"outofstock\">" . $product['stock_status'] . "</span></span>";
} else { 
echo "<img src=\"catalog/view/theme/default/image/cart-add.png\" alt=\"" . $button_cart . "\" title=\"" . $button_cart . "\" onclick=\"addToCart('" . $product['product_id'] . "');\" />";
} 
?>
]]></add>
		</operation>
	</file>
	
</modification>

Newbie

Posts

Joined
Fri Dec 18, 2015 2:27 pm

Post by IP_CAM » Thu Feb 25, 2016 2:12 am

You better just CHECK every instance, where <search position= exists, i.E., in the THEME File, related and linked to this function, i.E.:
<file name="catalog/view/theme/*/template/product/product.tpl"> (*=wildcard, functions for/in every theme!)
if the content EXACTLY matches the Content of the VqMod, including empty spaces, and everything else, beeing part of this line.

If it DOES NOT, replace the VqMod Content with the Code, as you have found, i.E., in the THEME File Source, related, and place this Line, or whatever it is, in exactly this way into the VqMod Place, where the 'not matching written' line exists.

SAMPLE1:

Code: Select all

<search position="replace" error="skip"><![CDATA[<img src="catalog/view/theme/default/image/cart-add.png" alt="<?php echo $button_cart; ?>" title="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" />]]></search>
EQUALS: (and to be checked for, in the related Default Page Source)

Code: Select all

<img src="catalog/view/theme/default/image/cart-add.png" alt="<?php echo $button_cart; ?>" title="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" />
TO SEARCH FOR, and possibly to replace !
---
SAMPLE2:

Code: Select all

<search position="after" offset="6"><![CDATA[if ($product_info['quantity'] <= 0) {]]></search>
EQUALS:(and to be checked for, in the related Default Page Source)

Code: Select all

if ($product_info['quantity'] <= 0) {
TO SEARCH FOR, and possibly to replace !

It's as easy as that, at least, if your VqMod itself still works, due to possible 'fundamental' differences, between the different OC2 Versions, such as even moving Files from one Subdirectory to another!! :o
But you just need to try, you are the only one, able to...
Good Luck ! ;)
Ernie
openshop.li

My Github OC Site: https://github.com/IP-CAM
5'600 + 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
Who is online

Users browsing this forum: No registered users and 2 guests