Post by ghetto_puppy » Wed Jul 24, 2013 7:49 am

This mod adds a column to the products on the checkout/cart page and labels them HEAVY based on their price/weight. This shows a red HEAVY for the heaviest products, and an orange HEAVY for not-as-heavy products. I also added a css class to display a note on hover. To see it work add this product to the cart and 'view cart': http://hydroharbor.com/index.php?route= ... ct_id=4444

heavy.xml:

Code: Select all

<modification>
	<id><![CDATA[Hover Heavy]]></id>
	<version><![CDATA[1.5.2.1]]></version>
	<vqmver><![CDATA[1.0.1]]></vqmver>
	<author><![CDATA[dan@hydroharbor.com]]></author>

	<file name="catalog/view/theme/default/template/checkout/cart.tpl">
		<operation>
			<search position="after" error="log"><![CDATA[<td class="quantity"><?php echo $column_quantity; ?></td>]]></search>
				<add><![CDATA[<td class="heavy"><?php echo $column_heavy; ?></td>

]]></add>
		</operation>
		<operation>
			<search position="after" error="log"><![CDATA[<img src="catalog/view/theme/default/image/remove.png" alt="<?php echo $button_remove; ?>" title="<?php echo $button_remove; ?>" /></a></td>]]></search>
				<add><![CDATA[<td class="heavy"><div class="tooltip-wrap"><?php echo $product['heavy']; ?><div class="tooltip-content">
    <p>This affects the cost of shipping!</p>
  </div> 
</div></td>

]]></add>
		</operation>	
		<operation>
			<search position="before" error="log"><![CDATA[<td class="price"><?php echo $vouchers['amount']; ?></td>]]></search>
			<add><![CDATA[<td></td>

]]></add>
		</operation>
	</file>
				
	<file name="catalog/language/english/checkout/cart.php">
		<operation>
			<search position="after" error="log"><![CDATA[$_['text_empty']             = 'Your shopping cart is empty!';]]></search>
			<add><![CDATA[

$_['text_heavy2']            = '<span style="color:#e65c00;cursor:help;font-weight:bold;">HEAVY</span>';
$_['text_heavy4']            = '<span style="color:#e9c161;cursor:help;font-weight:bold;">HEAVY</span>';
$_['column_heavy']            = '';

]]></add>
		</operation>
	</file>
	<file name="catalog/controller/checkout/cart.php">
	<operation>
			<search position="after" error="log"><![CDATA[$this->data['column_quantity'] = $this->language->get('column_quantity');]]></search>
			<add><![CDATA[$this->data['column_heavy'] = $this->language->get('column_heavy');
			]]>
			</add>
		</operation>
		<operation>
			<search position="after" error="log"><![CDATA['reward'   => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),]]></search>
			<add><![CDATA['heavy'    => $heavy,
			]]>
			</add>
		</operation>
		<operation>
			<search position="before" error="log"><![CDATA[$this->data['products'][] = array(]]></search>
			<add><![CDATA[if (($product['total'] < ($product['weight']*6)) && ($product['weight'] > 2)) {
					$heavy = $this->language->get('text_heavy2');
				} else if (($product['total'] < ($product['weight']*8.2)) && ($product['weight'] > 2)) {
					$heavy = $this->language->get('text_heavy4');
				} else {
					$heavy = false;
				}
			]]>
			</add>
		</operation>
	</file>
</modification>


added to stylesheet.css:

Code: Select all

.cart-info tbody .heavy {       
}
.cart-info thead .heavy {     
}
.tooltip-wrap {
  position: relative;
}
.tooltip-wrap .tooltip-content {
  display: none;
  width:140px;
  font-size: 10px;
  color: #333;
  position: absolute;
  top: 110%;
 
  background-color: #fff;
  padding: 5px;
}
.tooltip-wrap:hover .tooltip-content {
  display: block;
}

http://hydroharbor.com


Newbie

Posts

Joined
Sat Apr 28, 2012 8:49 am
Location - Tempe, Arizona, USA
Who is online

Users browsing this forum: No registered users and 5 guests