Post by billynoah » Wed Mar 12, 2014 2:52 am

Here's a free mod that replaces "mpn" field with "Product Display Price". The Product Display Price will display anywhere price is displayed (category, search, product pages, etc) if it is filled in. If not, the price will display as usual.

This is useful for situations where your price is set to 0 or some other arbitrary number and then set by options. You can have a product that is "$10.00 per cubic foot" for example and display just that.

Code: Select all

<modification>
	<id>Custom Field - Display Price</id>
	<version>1</version>
	<vqmver>2.4.1</vqmver>
	<author>Billy Noah - ZumaDesign.com</author>

	
	<file name="admin/language/english/catalog/product.php">
		<operation>
			<search position="replace"><![CDATA[MPN:<br/><span class="help">Manufacturer Part Number</span>]]></search>
				<add><![CDATA[Display Price:<br/><span class="help">Display this instead of price field on all pages</span>]]></add>
		</operation>
	</file>

	<!-- Include Above variables in database query

	############################################ -->

	<file name="catalog/model/catalog/product.php">
		<operation>
            <search position="before"><![CDATA[$query->row['special'],]]></search>
            <add><![CDATA[				'display_price'	=> $query->row['mpn'],]]></add>
		</operation>
	</file>
	
	

	<file name="catalog/controller/product/product.php">

		<operation>
			<search position="after"><![CDATA[$this->data['points'] = $product_info['points'];]]></search>
			<add><![CDATA[			$this->data['display_price'] = $product_info['mpn'];]]></add>
		</operation>
	</file>
	
	<file path="catalog/controller/product/" name="category.php,manufacturer.php,search.php,special.php">
		<operation>
			<search position="before"><![CDATA['price'       => $price,]]></search>
			<add><![CDATA[					'display_price' => html_entity_decode($result['mpn'], ENT_QUOTES, 'UTF-8'),]]></add>
		</operation>
	</file>

	<file name="catalog/controller/product/compare.php">
		<operation>
			<search position="before"><![CDATA['price'        => $price,]]></search>
			<add><![CDATA[			'display_price' => html_entity_decode($product_info['mpn'], ENT_QUOTES, 'UTF-8'),]]></add>
		</operation>
	</file>


	<file name="catalog/controller/module/featured.php">
		<operation>
			<search position="before"><![CDATA[if (($this->config->get('config_customer_price')]]></search>
			<add><![CDATA[
				if ($product_info['mpn']) {
					$price = html_entity_decode($product_info['mpn'], ENT_QUOTES, 'UTF-8');
				} else
			]]></add>
		</operation>
	</file>

	<!-- show display_price if it exists on various pages
	############################################ -->

	<file name="catalog/view/theme/*/template/product/product.tpl">
		<operation>
			<search position="replace"><![CDATA[<?php echo $price; ?>]]></search>
			<add><![CDATA[<?php if ($display_price) {echo $display_price;} else {echo $price;} ?>]]></add>
		</operation>
	</file>

	<file name="catalog/view/theme/*/template/product/compare.tpl">
		<operation>
			<search position="replace"><![CDATA[<?php if (!$products[$product['product_id']]['special']) { ?>]]></search>
			<add><![CDATA[
				<?php if ($products[$product['product_id']]['display_price']) { ?>
        		<?php echo $products[$product['product_id']]['display_price']; ?>
				<?php } else if (!$products[$product['product_id']]['special']) { ?>
			]]></add>
		</operation>
	</file>		
	
	<file path="catalog/view/theme/*/template/product/" name="category.tpl,search.tpl,manufacturer_info.tpl,special.tpl">
		<operation>
			<search position="replace"><![CDATA[<?php if (!$product['special']) { ?>]]></search>
			<add><![CDATA[
				<?php if ($product['display_price']) { ?>
        		<?php echo $product['display_price']; ?>
				<?php } else if (!$product['special']) { ?>
			]]></add>
		</operation>
	</file>

</modification>



Image


Active Member

Posts

Joined
Tue Jan 15, 2013 12:46 pm
Who is online

Users browsing this forum: No registered users and 2 guests