Attached Files |
add_to_compare_from_list.patch [^] (19,855 bytes) 2011-12-23 05:19
[Show Content]
Index: elements/content_boxes/products.elm.tpl
===================================================================
--- elements/content_boxes/products.elm.tpl (revision 14900)
+++ elements/content_boxes/products.elm.tpl (working copy)
@@ -23,6 +23,22 @@
<inp2:m_Include template="elements/pagination.elm" list_name="$list_name" prefix="$prefix" ajax="1"/>
</div>
+
+ <script type="text/javascript">
+ $(document).ready(
+ function () {
+ $('.compare-checkbox').click(
+ function ($e) {
+ var $me = $(this);
+
+ compare_product($me.val(), $me.is(':checked'));
+ }
+ );
+
+ $('.addtocart', '#products').click(add_to_cart_handler);
+ }
+ );
+ </script>
<inp2:m_else/>
No Products
</inp2:m_if>
Index: elements/html_head.elm.tpl
===================================================================
--- elements/html_head.elm.tpl (revision 14888)
+++ elements/html_head.elm.tpl (working copy)
@@ -14,7 +14,7 @@
<link rel="icon" href="<inp2:m_BaseURL/>favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<inp2:m_BaseURL/>favicon.ico" type="image/x-icon" />
-<link rel="stylesheet" type="text/css" href="<inp2:m_Compress files='inc/reset.css|inc/styles.css|inc/category.css|inc/flexslider.css|inc/modal.css|inc/details.css|inc/jquery.gzoom.css|inc/pikachoose.css|inc/qtip.css|inc/profile.css|inc/cart.css'/>" media="all" charset="<inp2:lang.current_Field name='Charset'/>"/>
+<link rel="stylesheet" type="text/css" href="<inp2:m_Compress files='inc/reset.css|inc/styles.css|inc/category.css|inc/flexslider.css|inc/modal.css|inc/details.css|inc/jquery.gzoom.css|inc/pikachoose.css|inc/qtip.css|inc/profile.css|inc/cart.css|inc/compare.css'/>" media="all" charset="<inp2:lang.current_Field name='Charset'/>"/>
<!-- including "inc/profile.css" will break logged-in user's menu -->
Index: elements/product_elements.elm.tpl
===================================================================
--- elements/product_elements.elm.tpl (revision 14888)
+++ elements/product_elements.elm.tpl (working copy)
@@ -23,7 +23,7 @@
<a href="<inp2:ProductLink template='__default__'/>">Reviews</a> (<a href="<inp2:ProductLink template='__default__'/>"><inp2:Field name="CachedReviewsQty"/></a>)
</span>
<span class="comp">
- <label><input type="checkbox" name="compare-1" value="1" /><em>Compare</em></label>
+ <label><input type="checkbox" class="compare-checkbox" value="<inp2:Field name='ProductId'/>"<inp2:m_if check="InCompare"> checked</inp2:m_if>/><em>Compare</em></label>
</span>
</div>
</div>
Index: elements/side_boxes/compare.elm.tpl
===================================================================
--- elements/side_boxes/compare.elm.tpl (revision 14888)
+++ elements/side_boxes/compare.elm.tpl (working copy)
@@ -1,32 +1,60 @@
-<inp2:p_InitList list_name="compare_products" types="compare" parent_cat_id="0" recursive="1" max="4"/>
+<inp2:m_if check="m_Get" name="ajax" equals_to="yes">
+ <inp2:m_NoDebug/>
+</inp2:m_if>
-<div class="block no-border-bottom">
- <h2><em>Comparing Products (3)</em><span class="bullet"></span></h2>
+<inp2:m_Include template="elements/content_boxes.elm" strip_nl="2"/>
+<inp2:m_Include template="elements/product_elements.elm" strip_nl="2"/>
+
+<inp2:p_InitList list_name="compare_products" types="compare" parent_cat_id="any" per_page="4"/>
+
+<div class="block no-border-bottom" id="compare-products-sidebox"<inp2:m_ifnot check="p_TotalRecords" list_name="compare_products"> style="display: none;"</inp2:m_ifnot>>
+ <h2>
+ <em>Comparing Products (<inp2:p_TotalRecords list_name="compare_products"/>)</em>
+ <span class="bullet"></span>
+ </h2>
<div class="good-item border-radius-bottom comparing-items">
- <dl>
- <dt><a href="#">Nikon D5000 Digital Camera</a></dt>
- <dd>
- <p class="img"><a href="#"><img src="<inp2:m_TemplatesBase/>img/samples/good1.jpg" width="136" height="136" alt="" /></a></p>
- <p class="button-delete"><a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a></p>
- </dd>
- </dl>
- <dl>
- <dt><a href="#">Nikon D5000 Digital Camera</a></dt>
- <dd>
- <p class="img"><a href="#"><img src="<inp2:m_TemplatesBase/>img/samples/good1.jpg" width="136" height="136" alt="" /></a></p>
- <p class="button-delete"><a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a></p>
- </dd>
- </dl>
- <dl>
- <dt><a href="#">Nikon D5000 Digital Camera</a></dt>
- <dd>
- <p class="img"><a href="#"><img src="<inp2:m_TemplatesBase/>img/samples/good1.jpg" width="136" height="136" alt="" /></a></p>
- <p class="button-delete"><a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a></p>
- </dd>
- </dl>
+ <inp2:m_DefineElement name="compare_product_element">
+ <dl>
+ <dt><a href="<inp2:ProductLink template='__default__'/>"><inp2:Field name="Name"/></a></dt>
+ <dd>
+ <p class="img">
+ <a href="<inp2:ProductLink template='__default__'/>">
+ <inp2:Image render_as="image_element" Primary="1" Thumbnail="1" DefaultImage="img/no_picture.gif" MaxWidth="136" MaxHeight="136"/>
+ </a>
+ </p>
+
+ <p class="button-delete">
+ <a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a>
+ </p>
+ </dd>
+ </dl>
+ </inp2:m_DefineElement>
+
+ <inp2:p_ListProducts list_name="compare_products" render_as="sidebox_product_element" no_table="1"/>
+
<p class="form buttons">
- <input type="submit" value="Compare" id="submit" class="green-button" />
- <input type="reset" value="Clear" id="cancel" class="grey-button" />
+ <input type="button" value="Compare" id="compare-products-btn" class="green-button" />
+ <input type="button" value="Clear" id="cancel-compare-btn" class="grey-button" />
</p>
</div>
-</div>
\ No newline at end of file
+</div>
+
+<script type="text/javascript">
+ $(document).ready(
+ function () {
+ $('.addtocart', '#compare-products-sidebox').click(add_to_cart_handler);
+
+ $('#compare-products-btn').click(
+ function () {
+ redirect('<inp2:m_Link template="products/compare" js_escape="1"/>');
+ }
+ );
+
+ $('#cancel-compare-btn').click(
+ function () {
+ compare_product(0, 'OnCancelCompare');
+ }
+ );
+ }
+ );
+</script>
\ No newline at end of file
Index: elements/side_boxes/subscribe.elm.tpl
===================================================================
--- elements/side_boxes/subscribe.elm.tpl (revision 14888)
+++ elements/side_boxes/subscribe.elm.tpl (working copy)
@@ -2,20 +2,20 @@
<div class="subscribe-block">
<h4>Get Promotions & Discounts:</h4>
- <form method="post" action="<inp2:m_FormAction />" class="form" name="mailing_list_form">
+ <form method="post" action="<inp2:m_FormAction />" class="form" name="mailing_list_form">
<fieldset>
<inp2:if check="u.subscribe-sidebox_Field" name="SubscriberEmail">
<input type="text" class="field subsfield" name="<inp2:u.subscribe-sidebox_InputName name='SubscriberEmail'/>" value="<inp2:u.subscribe-sidebox_Field name='SubscriberEmail'/>" onblur="if (this.value == '') this.value='Your Email'" onclick="if (this.value == 'Your Email') this.value=''"/>
<inp2:m_else/>
<input type="text" class="field subsfield" name="<inp2:u.subscribe-sidebox_InputName name='SubscriberEmail'/>" value="Your Email" onblur="if (this.value == '') this.value='Your Email'" onclick="if (this.value == 'Your Email') this.value=''" />
</inp2:if>
-
+
<inp2:m_if check="u.subscribe-sidebox_HasError" field="any">
<span class="field-error"><inp2:u.subscribe-sidebox_Error field="SubscriberEmail"/></span><br />
</inp2:m_if>
-
+
<a href="#" class="grey-but"><span><inp2:m_Phrase label='lu_btn_Subscribe' no_editing='1'/></span></a>
-
+
<input type="hidden" name="events[u.subscribe-sidebox][OnSubscribeQuery]" value="1"/>
<input type="hidden" name="subscribe_template" value="mailing/subscribe"/>
<input type="hidden" name="unsubscribe_template" value="mailing/unsubscribe"/>
Index: inc/js/form_manager.js
===================================================================
--- inc/js/form_manager.js (revision 14888)
+++ inc/js/form_manager.js (working copy)
@@ -363,6 +363,10 @@
};
FormManager.form_param = function ($prefix, $param, $value) {
+ if ( this.forms[$prefix] === undefined ) {
+ return '';
+ }
+
if ($value === undefined) {
return this.forms[$prefix][$param];
}
Index: inc/js/jquery.scripts.js
===================================================================
--- inc/js/jquery.scripts.js (revision 14890)
+++ inc/js/jquery.scripts.js (working copy)
@@ -86,6 +86,36 @@
return $sorted_object;
}
+function compare_product($product_id, $compare_event, $callback) {
+ if ( $compare_event === undefined || $compare_event === true ) {
+ $compare_event = 'OnAddToCompare';
+ }
+ else if ( $compare_event === false ) {
+ $compare_event = 'OnRemoveFromCompare';
+ }
+
+ var $url = FormManager.getURL('p', 'elements/side_boxes/compare.elm', $compare_event);
+
+ $.get(
+ $url,
+ {'p_id': $product_id},
+ function ($data) {
+ $('#compare-products-sidebox').replaceWith($data);
+
+ if ( $callback !== undefined && $.isFunction($callback) ) {
+ $callback($data);
+ }
+ }
+ );
+
+ return false;
+}
+
+function redirect($url)
+{
+ window.location.href = $url;
+}
+
/* === DBlocks class === */
function DBlocks() {
var $me = this;
@@ -171,63 +201,62 @@
)
}
-/* === Startup === */
-$(document).ready(
- function() {
- watch_anchor();
+function add_to_cart_handler() {
+ var $me = $(this),
+ $qty = $me.attr('qty_id') !== undefined ? parseInt($('#' + $me.attr('qty_id')).val()) : 1;
- $('#change-password').click(
- function($e) {
- $('#password-show').hide();
- $('#password-block').fadeIn();
- return false;
- }
- );
+ if ( $me.hasClass('addedtocart') ) {
+ // disabled button
+ return false;
+ }
+ if ( isNaN($qty) ) {
+ $qty = 1;
+ }
- $('.addtocart, .button-addtocart').click(
- function () {
- var $me = $(this),
- $qty = $me.attr('qty_id') !== undefined ? parseInt($('#' + $me.attr('qty_id')).val()) : 1;
+ var $bubble = $('.basketStatus'),
+ $timer_id = $bubble.data('hide_timer');
+ clearTimeout($timer_id);
- if ( $me.hasClass('addedtocart') ) {
- // disabled button
- return false;
+ $.get(
+ $me.attr('href') + '&qty=' + $qty,
+ function ($bubble_content) {
+ $('.basketContent', $bubble).html( $bubble_content.replace(/#QTY#/g, $qty) );
+ $bubble
+ .stop(true, true)
+ .fadeIn(
+ 'slow',
+ function () {
+ var $timer = setTimeout(function(){ $bubble.fadeOut('slow'); }, 2000);
+ $bubble.data('hide_timer', $timer);
}
+ );
- if ( isNaN($qty) ) {
- $qty = 1;
- }
+ if ( $me.hasClass('addtocart') ) {
+ $me.removeClass('addtocart').addClass('addedtocart').html('Added to Cart');
+ }
+ }
+ );
- var $bubble = $('.basketStatus'),
- $timer_id = $bubble.data('hide_timer');
+ return false;
+}
- clearTimeout($timer_id);
+/* === Startup === */
+$(document).ready(
+ function() {
+ watch_anchor();
- $.get(
- $me.attr('href') + '&qty=' + $qty,
- function ($bubble_content) {
- $('.basketContent', $bubble).html( $bubble_content.replace(/#QTY#/g, $qty) );
- $bubble
- .stop(true, true)
- .fadeIn(
- 'slow',
- function () {
- var $timer = setTimeout(function(){ $bubble.fadeOut('slow'); }, 2000);
- $bubble.data('hide_timer', $timer);
- }
- );
+ $('#change-password').click(
+ function($e) {
+ $('#password-show').hide();
+ $('#password-block').fadeIn();
- if ( $me.hasClass('addtocart') ) {
- $me.removeClass('addtocart').addClass('addedtocart').html('Added to Cart');
- }
- }
- );
-
return false;
}
);
+
+ $('.addtocart, .button-addtocart').click(add_to_cart_handler);
}
);
\ No newline at end of file
Index: products/compare.tpl
===================================================================
--- products/compare.tpl (revision 0)
+++ products/compare.tpl (revision 0)
@@ -0,0 +1,159 @@
+<!--##
+<NAME>Compare Products</NAME>
+<DESC>Product comparison page</DESC>
+<SECTION>Pages||Compare Products</SECTION>
+##-->
+<inp2:m_DefineElement name="page_title"><inp2:st_PageInfo type="htmlhead_title" html_escape="1"/></inp2:m_DefineElement>
+
+<!--## MAIN CONTENT ##-->
+<inp2:m_DefineElement name="content">
+ <div class="block no-border-bottom">
+ <h2><em>Comparing Products (4)</em><span></span></h2>
+ <div class="compare border-radius">
+
+ <div class="good-item">
+ <div class="button-delete"><a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a></div>
+ <dl>
+ <dt><a href="#">Nikon D5000 Digital Camera</a></dt>
+ <dd>
+ <p class="img"><a href="#"><img src="<inp2:m_TemplatesBase/>img/samples/good1.jpg" width="136" height="136" alt="" /></a></p>
+ <p class="price">$759.<span>95</span></p>
+ <p><a href="#" class="addtocart"><span>Add to Cart</span></a></p>
+ </dd>
+ </dl>
+ <div class="rating">
+ <p><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /></p>
+ <p><a href="">Reviews</a> (<a href="">12</a>)</p>
+ </div>
+ <dl class="har">
+ <dt>Model:</dt>
+ <dd>XT2324</dd>
+ <dt>Manufacturer:</dt>
+ <dd>Apple</dd>
+ <dt>SKU:</dt>
+ <dd>23423424</dd>
+ <dt>Size:</dt>
+ <dd>22''</dd>
+ </dl>
+ </div>
+ <div class="good-item">
+ <div class="button-delete"><a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a></div>
+ <dl>
+ <dt><a href="#">Nikon D5000 Digital Camera</a></dt>
+ <dd>
+ <p class="img"><a href="#"><img src="<inp2:m_TemplatesBase/>img/samples/good1.jpg" width="136" height="136" alt="" /></a></p>
+ <p class="price">$759.<span>95</span></p>
+ <p><a href="#" class="addtocart"><span>Add to Cart</span></a></p>
+ </dd>
+ </dl>
+ <div class="rating">
+ <p><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /></p>
+ <p><a href="">Reviews</a> (<a href="">12</a>)</p>
+ </div>
+ <dl class="har">
+ <dt>Model:</dt>
+ <dd>XT2324</dd>
+ <dt>Manufacturer:</dt>
+ <dd>Apple</dd>
+ <dt>SKU:</dt>
+ <dd>23423424</dd>
+ <dt>Size:</dt>
+ <dd>22''</dd>
+ </dl>
+ </div>
+ <div class="good-item">
+ <div class="button-delete"><a href="#"><img src="<inp2:m_TemplatesBase/>img/icon-delete.png" width="13" height="13" alt="" /></a></div>
+ <dl>
+ <dt><a href="#">Nikon D5000 Digital Camera</a></dt>
+ <dd>
+ <p class="img"><a href="#"><img src="<inp2:m_TemplatesBase/>img/samples/good1.jpg" width="136" height="136" alt="" /></a></p>
+ <p class="price">$759.<span>95</span></p>
+ <p><a href="#" class="addtocart"><span>Add to Cart</span></a></p>
+ </dd>
+ </dl>
+ <div class="rating">
+ <p><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /><img src="<inp2:m_TemplatesBase/>img/star-small.jpg" width="18" height="18" alt="" /></p>
+ <p><a href="">Reviews</a> (<a href="">12</a>)</p>
+ </div>
+ <dl class="har">
+ <dt>Model:</dt>
+ <dd>XT2324</dd>
+ <dt>Manufacturer:</dt>
+ <dd>Apple</dd>
+ <dt>SKU:</dt>
+ <dd>23423424</dd>
+ <dt>Size:</dt>
+ <dd>22''</dd>
+ </dl>
+ </div>
+ <div class="good-item last-child">
+ <p class="buttons-block"><a href="#" class="compare-button"><span><img src="<inp2:m_TemplatesBase/>img/bg-button-compare-add.png" width="24" height="24" alt="" /><br />Select Product<br />to Compare</span></a></p>
+ </div>
+ <div class="clear"></div>
+
+ <div id="compare-menu" style="width: 678px;">
+ <h3><a href="#">Description</a></h3>
+ <div>
+ <div class="good-item-cell">
+ <div class="description">
+ <p>Vestibulum eu ipsum est. Morbi risus magna, aliquam eu consequat in, ultricies quis lorem. Maecenas rutrum pulvinar lectus, vel aliquam lorem porttitor nec. Phasellus non orci sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec massa massa. Proin ac leo mauris.</p><p>Mauris ut felis Phasellus non orci sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec massa massa. Proin ac leo mauris.</p>
+ </div>
+ </div>
+ <div class="good-item-cell">
+ <div class="description">
+ <p>Vestibulum eu ipsum est. Morbi risus magna, aliquam eu consequat in, ultricies quis lorem. Maecenas rutrum pulvinar lectus, vel aliquam lorem porttitor nec. Phasellus non orci sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec massa massa. Proin ac leo mauris.</p><p>Mauris ut felis Phasellus non orci sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec massa massa. Proin ac leo mauris.</p>
+ </div>
+ </div>
+ <div class="good-item-cell">
+ <div class="description">
+ <p>Vestibulum eu ipsum est. Morbi risus magna, aliquam eu consequat in, ultricies quis lorem. Maecenas rutrum pulvinar lectus, vel aliquam lorem porttitor nec. Phasellus non orci sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec massa massa. Proin ac leo mauris.</p><p>Mauris ut felis Phasellus non orci sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec massa massa. Proin ac leo mauris.</p>
+ </div>
+ </div>
+ <div class="clear"></div>
+ </div>
+ <h3><a href="#">Features</a></h3>
+ <div>
+
+ </div>
+ <h3><a href="#">Details</a></h3>
+ <div>
+
+ </div>
+ <h3><a href="#">Specifications</a></h3>
+ <div>
+
+ </div>
+ <h3><a href="#">Overall Rating</a></h3>
+ <div>
+
+ </div>
+ <h3><a href="#">Reviews</a></h3>
+ <div>
+
+ </div>
+ </div>
+ <div class="clear"></div>
+ </div>
+ </div>
+</inp2:m_DefineElement>
+<!--## /MAIN CONTENT ##-->
+
+<inp2:m_DefineElement name="add_to_head">
+ <script type= "text/javascript">
+ $(function() {
+ var icons = {
+ header: "ui-icon-circle-arrow-e",
+ headerSelected: "ui-icon-circle-arrow-s"
+ };
+ $( "#compare-menu" ).accordion({
+ icons: icons,
+ autoHeight: false,
+ navigation: true
+ });
+ });
+ </script>
+</inp2:m_DefineElement>
+
+<!--## DESIGN TEMPLATE ##-->
+<inp2:m_include template="designs/default_design.des" pass_params="1"/>
+<!--## /DESIGN TEMPLATE ##-->
\ No newline at end of file
CompareBubble.patch [^] (3,942 bytes) 2012-01-13 11:34
[Show Content]
Index: elements/product_elements.elm.tpl
===================================================================
--- elements/product_elements.elm.tpl (revision 15040)
+++ elements/product_elements.elm.tpl (working copy)
@@ -23,7 +23,30 @@
<a href="<inp2:ProductLink template='__default__'/>">Reviews</a> (<a href="<inp2:ProductLink template='__default__'/>"><inp2:Field name="CachedReviewsQty"/></a>)
</span>
<span class="comp">
- <label><input type="checkbox" class="compare-checkbox" value="<inp2:Field name='ProductId'/>"<inp2:m_if check="InCompare"> checked</inp2:m_if>/><em>Compare</em></label>
+ <label>
+ <input class="left" type="checkbox" class="compare-checkbox" value="<inp2:Field name='ProductId'/>"<inp2:m_if check="InCompare"> checked</inp2:m_if>/>
+ <div class="compare-bubble">
+ <div class="formStatus formSuccess">
+ <div class="formContent">Added to Comparison</div>
+ <div class="formArrow"></div>
+ </div>
+ </div>
+ <!--
+ <div class="compare-bubble">
+ <div class="formStatus formError">
+ <div class="formContent">Up to 4 products can be compared</div>
+ <div class="formArrow"></div>
+ </div>
+ </div>
+ <div class="compare-bubble">
+ <div class="formStatus formNeutral">
+ <div class="formContent">Removed from Comparison</div>
+ <div class="formArrow"></div>
+ </div>
+ </div>
+ -->
+ <em style="display:block" class="left">Compare</em>
+ </label>
</span>
</div>
</div>
Index: inc/styles.css
===================================================================
--- inc/styles.css (revision 15040)
+++ inc/styles.css (working copy)
@@ -21,6 +21,9 @@
.clear { clear: both !important; }
.fix { border: 1px solid #f00; }
+.left { float:left }
+.right { float: right }
+
/* Header
*******************************************************************************/
#header {
@@ -1333,12 +1336,20 @@
font-weight: bold;
padding-bottom: 5px;
}
-.items .item .descr .optional { padding: 5px 0; }
-.items .item .descr .optional .stars { padding: 0 20px 0 0; }
+.items .item .descr .optional { padding: 15px 0 5px 0; }
+.items .item .descr .optional .stars { padding: 0 20px 0 0; display:block; float:left }
+.items .item .descr .optional .reviews { width:auto; padding-top:0px; padding-right:20px; border:0px; }
.items .item .descr .optional .comp label em {
font-style: normal;
text-decoration: underline;
}
+
+
+
+
+
+
+
.items .item .descr .optional .comp label input {
bottom: -2px;
margin: 0 5px 0 0;
@@ -2334,6 +2345,27 @@
.formStatus.formError .formContent { background: #990000 url(@templates_base@/img/validate/con-error.png) repeat-x 0 0; }
.formStatus.formError .formArrow { background: url(@templates_base@/img/validate/con-error-arrow.png) no-repeat 0 0; }
+.compare-bubble { width:1px; height:1px; position:relative; float:left }
+.compare-bubble .formStatus {
+ top: -37px;
+ left: -42px;
+}
+
+.compare-bubble .formStatus .formContent { width: auto }
+
+.compare-bubble .formStatus .formArrow {
+ margin: 0px 0 0 20px;
+ position: relative;
+}
+
+.compare-bubble .formStatus.formSuccess .formArrow { background: url(@templates_base@/img/validate/con-success-arrow-bottom.png) no-repeat 0 0; }
+.compare-bubble .formStatus.formError .formArrow { background: url(@templates_base@/img/validate/con-error-arrow-bottom.png) no-repeat 0 0; }
+
+.compare-bubble .formStatus.formNeutral .formContent { background: #990000 url(@templates_base@/img/validate/con-neutral.png) repeat-x 0 0; }
+.compare-bubble .formStatus.formNeutral .formArrow { background: url(@templates_base@/img/validate/con-neutral-arrow-bottom.png) no-repeat 0 0; }
+
+
+
.cart-detail.receipt .items .item-quantity .formStatus { left: 0; }
.cart-detail.receipt dl.total { float: right; padding-right: 30px; }
validate.zip [^] (12,955 bytes) 2012-01-13 11:36
Category7_a3.jpg [^] (544,381 bytes) 2012-01-16 03:40
max_compare_limit_modules.patch [^] (6,568 bytes) 2012-01-16 05:22
[Show Content]
Index: install/english.lang
===================================================================
--- install/english.lang (revision 15041)
+++ install/english.lang (working copy)
@@ -127,6 +127,7 @@
<PHRASE Label="la_comm_OrderContents" Module="In-Commerce" Type="1">T3JkZXIgQ29udGVudHM=</PHRASE>
<PHRASE Label="la_comm_ShippingBillingInfo" Module="In-Commerce" Type="1">U2hpcHBpbmcgJiBCaWxsaW5nIEluZm9ybWF0aW9u</PHRASE>
<PHRASE Label="la_comm_Timeframe" Module="In-Commerce" Type="1">VGltZWZyYW1l</PHRASE>
+ <PHRASE Label="la_config_MaxCompareProducts" Module="In-Commerce" Type="1">TWF4aW1hbCBudW1iZXIgb2YgcHJvZHVjdHMgaW4gY29tcGFyaXNvbiBsaXN0</PHRASE>
<PHRASE Label="la_config_OrderVATIncluded" Module="In-Commerce" Type="1">VGF4ZXMgaW5jbHVkZWQgaW4gcHJvZHVjdCBwcmljZSwgc2hpcHBpbmcgY29zdCAmIHByb2Nlc3NpbmcgZmVl</PHRASE>
<PHRASE Label="la_config_ShowProductImagesInOrders" Module="In-Commerce" Type="1">U2hvdyBQcm9kdWN0IEltYWdlcyBpbiBPcmRlcnM=</PHRASE>
<PHRASE Label="la_conf_DaysToBeNew" Module="In-Commerce" Type="1">TnVtYmVyIG9mIGRheXMgZm9yIGEgcHJvZHVjdCB0byBiZSBOZXc=</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 15041)
+++ install/install_data.sql (working copy)
@@ -53,6 +53,7 @@
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_RatingDelay_Value', '30', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'text', '', 'style="width: 50px;"', 10.1, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_RatingDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'select', '', '1=la_opt_Sec||60=la_opt_Min||3600=la_opt_Hour||86400=la_opt_Day||604800=la_opt_Week||2419200=la_opt_Month||29030400=la_opt_Year', 10.1, 2, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'ShowProductImagesInOrders', '0', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_ShowProductImagesInOrders', 'checkbox', NULL, NULL, 10.11, 0, 1, NULL);
+INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxCompareProducts', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_MaxCompareProducts', 'text', NULL, NULL, 10.12, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'Comm_Perpage_Reviews', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_config_PerpageReviews', 'text', NULL, NULL, 20.01, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_ReviewDelay_Value', '30', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'text', '', 'style="width: 50px;"', 20.02, 1, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'product_ReviewDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'select', '', '1=la_opt_Sec||60=la_opt_Min||3600=la_opt_Hour||86400=la_opt_Day||604800=la_opt_Week||2419200=la_opt_Month||29030400=la_opt_Year', 20.02, 2, 1, NULL);
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 15041)
+++ install/upgrades.sql (working copy)
@@ -257,3 +257,5 @@
'Comm_Order_Number_Format_S', 'Comm_RecurringChargeInverval', 'Comm_AutoProcessRecurringOrders', 'MaxAddresses',
'Comm_MaskProcessedCreditCards', 'OrderVATIncluded'
);
+
+INSERT INTO SystemSettings VALUES(DEFAULT, 'MaxCompareProducts', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_MaxCompareProducts', 'text', NULL, NULL, 10.12, 0, 1, NULL);
Index: units/products/products_event_handler.php
===================================================================
--- units/products/products_event_handler.php (revision 15041)
+++ units/products/products_event_handler.php (working copy)
@@ -538,17 +538,25 @@
// recent products: end
// compare products: begin
- $compare_products = $this->getCompareProducts();
- if ( $compare_products ) {
- $compare_products = $this->Conn->qstrArray($compare_products);
- $type_clauses['compare']['include'] = '%1$s.ProductId IN (' . implode(',', $compare_products) . ') AND PrimaryCat = 1';
- $type_clauses['compare']['except'] = '%1$s.ProductId NOT IN (' . implode(',', $compare_products) . ') AND PrimaryCat = 1';
+ if ( in_array('compare', $types) || in_array('compare', $except_types) ) {
+ $compare_products = $this->getCompareProducts();
+
+ if ( $compare_products ) {
+ $compare_products = $this->Conn->qstrArray($compare_products);
+ $type_clauses['compare']['include'] = '%1$s.ProductId IN (' . implode(',', $compare_products) . ') AND PrimaryCat = 1';
+ $type_clauses['compare']['except'] = '%1$s.ProductId NOT IN (' . implode(',', $compare_products) . ') AND PrimaryCat = 1';
+ }
+ else {
+ $type_clauses['compare']['include'] = '0';
+ $type_clauses['compare']['except'] = '1';
+ }
+
+ $type_clauses['compare']['having_filter'] = false;
+
+ if ( $event->getEventParam('per_page') === false ) {
+ $event->setEventParam('per_page', $this->Application->ConfigValue('MaxCompareProducts'));
+ }
}
- else {
- $type_clauses['compare']['include'] = '0';
- $type_clauses['compare']['except'] = '1';
- }
- $type_clauses['compare']['having_filter'] = false;
// compare products: end
// products already in shopping cart: begin
@@ -1482,13 +1490,23 @@
protected function OnAddToCompare(kEvent &$event)
{
$products = $this->getCompareProducts();
-
$product_id = (int)$this->Application->GetVar($event->Prefix . '_id');
if ( $product_id ) {
- $products[] = $product_id;
- $this->Application->Session->SetCookie('compare_products', implode('|', array_unique($products)));
+ $max_products = $this->Application->ConfigValue('MaxCompareProducts');
+
+ if ( count($products) < $max_products ) {
+ $products[] = $product_id;
+ $this->Application->Session->SetCookie('compare_products', implode('|', array_unique($products)));
+
+ $event->SetRedirectParam('result', 'added');
+ }
+ else {
+ $event->SetRedirectParam('result', 'error');
+ }
}
+
+ $event->SetRedirectParam('pass', 'm,p');
}
/**
@@ -1507,7 +1525,11 @@
if ( $product_id && in_array($product_id, $products) ) {
$products = array_diff($products, Array ($product_id));
$this->Application->Session->SetCookie('compare_products', implode('|', array_unique($products)));
+
+ $event->SetRedirectParam('result', 'removed');
}
+
+ $event->SetRedirectParam('pass', 'm,p');
}
/**
max_compare_limit_themes.patch [^] (10,415 bytes) 2012-01-16 05:22
[Show Content]
Index: elements/content_boxes/products.elm.tpl
===================================================================
--- elements/content_boxes/products.elm.tpl (revision 15035)
+++ elements/content_boxes/products.elm.tpl (working copy)
@@ -29,7 +29,7 @@
<script type="text/javascript">
$(document).ready(
function () {
- $('.compare-checkbox').click(
+ $('.compare-checkbox', '#products').click(
function ($e) {
var $me = $(this);
Index: elements/product_elements.elm.tpl
===================================================================
--- elements/product_elements.elm.tpl (revision 15036)
+++ elements/product_elements.elm.tpl (working copy)
@@ -23,7 +23,9 @@
<a href="<inp2:ProductLink template='__default__'/>">Reviews</a> (<a href="<inp2:ProductLink template='__default__'/>"><inp2:Field name="CachedReviewsQty"/></a>)
</span>
<span class="comp">
- <label><input type="checkbox" class="compare-checkbox" value="<inp2:Field name='ProductId'/>"<inp2:m_if check="InCompare"> checked</inp2:m_if>/><em>Compare</em></label>
+ <label class="compare-bubble">
+ <input type="checkbox" class="left compare-checkbox" value="<inp2:Field name='ProductId'/>"<inp2:m_if check="InCompare"> checked</inp2:m_if>/><em style="display:block" class="left">Compare</em>
+ </label>
</span>
</div>
</div>
Index: elements/side_boxes/compare.elm.tpl
===================================================================
--- elements/side_boxes/compare.elm.tpl (revision 15035)
+++ elements/side_boxes/compare.elm.tpl (working copy)
@@ -5,7 +5,7 @@
<inp2:m_Include template="elements/content_boxes.elm" strip_nl="2"/>
<inp2:m_Include template="elements/product_elements.elm" strip_nl="2"/>
-<inp2:p_InitList list_name="compare_products" types="compare" parent_cat_id="any" per_page="3"/>
+<inp2:p_InitList list_name="compare_products" types="compare" parent_cat_id="any"/>
<div class="block no-border-bottom" id="compare-products-sidebox"<inp2:m_ifnot check="p_TotalRecords" list_name="compare_products"> style="display: none;"</inp2:m_ifnot>>
<h2>
@@ -46,6 +46,23 @@
return false;
}
);
+
+ <inp2:m_if check="m_Get" name="result">
+ var $compare_checkbox = $(".compare-checkbox[value='<inp2:m_Get name="p_id"/>']", '#products');
+
+ <inp2:m_if check="m_Get" name="result" equals_to="added">
+ create_tooltip($compare_checkbox, 'Added to Comparison', 'formSuccess');
+ </inp2:m_if>
+
+ <inp2:m_if check="m_Get" name="result" equals_to="removed">
+ create_tooltip($compare_checkbox, 'Removed from Comparison', 'formNeutral');
+ </inp2:m_if>
+
+ <inp2:m_if check="m_Get" name="result" equals_to="error">
+ create_tooltip($compare_checkbox, 'Up to <inp2:m_GetConfig name="MaxCompareProducts"/> products can be compared', 'formError');
+ $compare_checkbox.attr('checked', false);
+ </inp2:m_if>
+ </inp2:m_if>
}
);
</script>
\ No newline at end of file
Index: img/validate/con-error-arrow-bottom.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: img\validate\con-error-arrow-bottom.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: img/validate/con-neutral-arrow-bottom.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: img\validate\con-neutral-arrow-bottom.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: img/validate/con-neutral.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: img\validate\con-neutral.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: img/validate/con-success-arrow-bottom.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: img\validate\con-success-arrow-bottom.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Index: inc/js/cart_manager.js
===================================================================
--- inc/js/cart_manager.js (revision 15035)
+++ inc/js/cart_manager.js (working copy)
@@ -563,41 +563,27 @@
ShopCartManager.prototype.createTooltip = function ($input, $tooltip_options) {
var $me = this,
- $tooltip = $input.next('.formStatus'),
- $is_error = $tooltip_options.classes == 'ui-tooltip-red',
- $timer = $input.data('timer');
+ $is_error = $tooltip_options.classes == 'ui-tooltip-red';
- clearTimeout($timer);
-
- if ( $tooltip.length == 1 ) {
- $tooltip.hide().remove();
- }
-
- $tooltip = $('<div class="formStatus ' + ($is_error ? 'formError' : 'formSuccess') + '" style="display: none;">\
- <div class="formContent">' + $tooltip_options.text + '</div>\
- <div class="formArrow"></div>\
- </div>');
-
- $input
- .after($tooltip)
- .removeClass('statusSuccess statusError')
- .addClass($is_error ? 'statusError' : 'statusSuccess');
-
- $tooltip.fadeIn(
- 'slow',
- function () {
- $timer = setTimeout( function() { $me.removeTooltip($input); }, 2000);
- $input.data('timer', $timer);
+ create_tooltip(
+ $input,
+ $tooltip_options.text,
+ $is_error ? 'formError' : 'formSuccess',
+ function ($input) {
+ $me.removeTooltip($input);
}
);
- $input.focus( function() { $me.removeTooltip($input); } );
+ $input
+ .removeClass('statusSuccess statusError')
+ .addClass($is_error ? 'statusError' : 'statusSuccess')
+ .focus( function() { $me.removeTooltip($input); } );
}
ShopCartManager.prototype.removeTooltip = function ($input) {
- var $tooltip = $input.next('.formStatus');
+ remove_tooltip($input);
+
$input.removeClass('statusError').removeClass('statusSuccess');
- $tooltip.fadeOut('slow', function() { $tooltip.remove(); });
}
ShopCartManager.prototype.getTooltipOptions = function ($text, $css_classes) {
Index: inc/js/jquery.scripts.js
===================================================================
--- inc/js/jquery.scripts.js (revision 15035)
+++ inc/js/jquery.scripts.js (working copy)
@@ -147,6 +147,42 @@
);
}
+function create_tooltip($input, $text, $css_class, $remove_function) {
+ var $tooltip = $input.next('.formStatus'),
+ $timer = $input.data('timer');
+
+ clearTimeout($timer);
+
+ if ( $tooltip.length == 1 ) {
+ $tooltip.hide().remove();
+ }
+
+ var $tooltip = $('<div class="formStatus ' + $css_class + '" style="display: none;">\
+ <div class="formContent">' + $text + '</div>\
+ <div class="formArrow"></div>\
+ </div>');
+
+ $input.after($tooltip);
+
+ if ($remove_function === undefined) {
+ $remove_function = remove_tooltip;
+ }
+
+ $tooltip.fadeIn(
+ 'slow',
+ function () {
+ $timer = setTimeout( function() { $remove_function($input); }, 2000);
+ $input.data('timer', $timer);
+ }
+ );
+}
+
+function remove_tooltip ($input) {
+ var $tooltip = $input.next('.formStatus');
+
+ $tooltip.fadeOut('slow', function() { $tooltip.remove(); });
+}
+
/* === DBlocks class === */
function DBlocks() {
var $me = this;
Index: inc/styles.css
===================================================================
--- inc/styles.css (revision 15035)
+++ inc/styles.css (working copy)
@@ -21,6 +21,9 @@
.clear { clear: both !important; }
.fix { border: 1px solid #f00; }
+.left { float:left }
+.right { float: right }
+
/* Header
*******************************************************************************/
#header {
@@ -1333,8 +1336,23 @@
font-weight: bold;
padding-bottom: 5px;
}
-.items .item .descr .optional { padding: 5px 0; }
-.items .item .descr .optional .stars { padding: 0 20px 0 0; }
+
+.items .item .descr .optional {
+ padding: 15px 0 5px 0;
+}
+
+.items .item .descr .optional .stars {
+ padding: 0 20px 0 0;
+ display: block;
+ float: left
+}
+
+.items .item .descr .optional .reviews {
+ width: auto;
+ padding-top: 0px;
+ padding-right: 20px;
+ border: 0px;
+}
.items .item .descr .optional .comp label em {
font-style: normal;
text-decoration: underline;
@@ -2334,6 +2352,28 @@
.formStatus.formError .formContent { background: #990000 url(@templates_base@/img/validate/con-error.png) repeat-x 0 0; }
.formStatus.formError .formArrow { background: url(@templates_base@/img/validate/con-error-arrow.png) no-repeat 0 0; }
+.compare-bubble {
+ position: relative;
+}
+
+.compare-bubble .formStatus {
+ top: -25px;
+ left: -94px;
+}
+
+.compare-bubble .formStatus .formContent { width: auto }
+
+.compare-bubble .formStatus .formArrow {
+ margin: 0px 0 0 20px;
+ position: relative;
+}
+
+.compare-bubble .formStatus.formSuccess .formArrow { background: url(@templates_base@/img/validate/con-success-arrow-bottom.png) no-repeat 0 0; }
+.compare-bubble .formStatus.formError .formArrow { background: url(@templates_base@/img/validate/con-error-arrow-bottom.png) no-repeat 0 0; }
+
+.compare-bubble .formStatus.formNeutral .formContent { background: #990000 url(@templates_base@/img/validate/con-neutral.png) repeat-x 0 0; }
+.compare-bubble .formStatus.formNeutral .formArrow { background: url(@templates_base@/img/validate/con-neutral-arrow-bottom.png) no-repeat 0 0; }
+
.cart-detail.receipt .items .item-quantity .formStatus { left: 0; }
.cart-detail.receipt dl.total { float: right; padding-right: 30px; }
Index: products/compare.tpl
===================================================================
--- products/compare.tpl (revision 15035)
+++ products/compare.tpl (working copy)
@@ -7,7 +7,7 @@
<!--## MAIN CONTENT ##-->
<inp2:m_DefineElement name="content">
- <inp2:p_InitList list_name="compare_products" types="compare" parent_cat_id="any" per_page="3"/>
+ <inp2:p_InitList list_name="compare_products" types="compare" parent_cat_id="any"/>
<inp2:m_ifnot check="p_TotalRecords" list_name="compare_products">
<inp2:p_ContinueLink redirect="1"/>
|