Jump to content

cartblock separated from blockuserinfo, but cartblock is not independent


Recommended Posts

I'm afraid I have to open a new post on the issue of moving cartblock to the right colum, because I have a particular layout.

I have separated the cart from the welcome/login/logout links, the latter now being inside tophorizontalmenu. Whenever I try to hook the cart elsewhere it just spoils all the design, and actually loses the ajax slide onmouseover feature.

I have attached a screenshot, how can I move the cartblock to the new position?

post-85445-0-81960700-1393178264_thumb.jpg

Link to comment
Share on other sites

just move the code (from blockuserinfo.tpl) to blockcart.tpl

		<li id="shopping_cart">
			<a href="{$link->getPageLink($order_process, true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">{l s='Cart' mod='blockuserinfo'}
			<span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span>
			<span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='Product' mod='blockuserinfo'}</span>
			<span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Products' mod='blockuserinfo'}</span>
			<span class="ajax_cart_total{if $cart_qties == 0} hidden{/if}">
				{if $cart_qties > 0}
					{if $priceDisplay == 1}
						{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
						{convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)}
					{else}
						{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
						{convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)}
					{/if}
				{/if}
			</span>
			<span class="ajax_cart_no_product{if $cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span>
			</a>
		</li>

in addition, you have to unhook block cart from displayTop section (not displayHeader!)

Link to comment
Share on other sites

if it's not too much asking, where exactly should I insert the cut code from blockuserinfo.tpl to?  Thank you.

<!-- MODULE Block cart -->
<div id="cart_block" class="block exclusive">
	<h4 class="title_block">
		<a href="{$link->getPageLink("$order_process", true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockcart'}" rel="nofollow">{l s='Cart' mod='blockcart'}</a>
		{if $ajax_allowed}
		<span id="block_cart_expand" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !isset($colapseExpandStatus)}class="hidden"{/if}> </span>
		<span id="block_cart_collapse" {if isset($colapseExpandStatus) && $colapseExpandStatus eq 'collapsed'}class="hidden"{/if}> </span>
		{/if}
	</h4>
	<div class="block_content">
	<!-- block summary -->
	<div id="cart_block_summary" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}collapsed{else}expanded{/if}">
		<span class="ajax_cart_quantity" {if $cart_qties <= 0}style="display:none;"{/if}>{$cart_qties}</span>
		<span class="ajax_cart_product_txt_s" {if $cart_qties <= 1}style="display:none"{/if}>{l s='Products' mod='blockcart'}</span>
		<span class="ajax_cart_product_txt" {if $cart_qties > 1}style="display:none"{/if}>{l s='Product' mod='blockcart'}</span>
		<span class="ajax_cart_total" {if $cart_qties == 0}style="display:none"{/if}>
			{if $cart_qties > 0}
				{if $priceDisplay == 1}
					{convertPrice price=$cart->getOrderTotal(false)}
				{else}
					{convertPrice price=$cart->getOrderTotal(true)}
				{/if}
			{/if}
		</span>
		<span class="ajax_cart_no_product" {if $cart_qties != 0}style="display:none"{/if}>{l s='(empty)' mod='blockcart'}</span>
	</div>
	<!-- block list of products -->
	<div id="cart_block_list" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}expanded{else}collapsed{/if}">
	{if $products}
		<dl class="products">
		{foreach from=$products item='product' name='myLoop'}
			{assign var='productId' value=$product.id_product}
			{assign var='productAttributeId' value=$product.id_product_attribute}
			<dt id="cart_block_product_{$product.id_product}_{if $product.id_product_attribute}{$product.id_product_attribute}{else}0{/if}_{if $product.id_address_delivery}{$product.id_address_delivery}{else}0{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">
				<span class="quantity-formated"><span class="quantity">{$product.cart_quantity}</span>x</span>
				<a class="cart_block_product_name" href="{$link->getProductLink($product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'html'}" title="{$product.name|escape:html:'UTF-8'}">
				{$product.name|truncate:13:'...'|escape:html:'UTF-8'}</a>
				<span class="remove_link">{if !isset($customizedDatas.$productId.$productAttributeId) && (!isset($product.is_gift) || !$product.is_gift)}<a rel="nofollow" class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete=1&id_product={$product.id_product}&ipa={$product.id_product_attribute}&id_address_delivery={$product.id_address_delivery}&token={$static_token}", true)|escape:'html'}" title="{l s='Please remove this product from my cart.' mod='blockcart'}"> </a>{/if}</span>
				<span class="price">
					{if !isset($product.is_gift) || !$product.is_gift}
						{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if}
					{else}
						<b>{l s='Free!' mod='blockcart'}</b>
					{/if}
				</span>
			</dt>
			{if isset($product.attributes_small)}
			<dd id="cart_block_combination_of_{$product.id_product}{if $product.id_product_attribute}_{$product.id_product_attribute}{/if}_{$product.id_address_delivery|intval}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">
				<a href="{$link->getProductLink($product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|escape:'html'}" title="{l s='Product detail' mod='blockcart'}">{$product.attributes_small}</a>
			{/if}

			<!-- Customizable datas -->
			{if isset($customizedDatas.$productId.$productAttributeId[$product.id_address_delivery])}
				{if !isset($product.attributes_small)}<dd id="cart_block_combination_of_{$product.id_product}_{if $product.id_product_attribute}{$product.id_product_attribute}{else}0{/if}_{if $product.id_address_delivery}{$product.id_address_delivery}{else}0{/if}" class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}">{/if}
				<ul class="cart_block_customizations" id="customization_{$productId}_{$productAttributeId}">
					{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization' name='customizations'}
						<li name="customization">
							<div class="deleteCustomizableProduct" id="deleteCustomizableProduct_{$id_customization|intval}_{$product.id_product|intval}_{$product.id_product_attribute|intval}_{$product.id_address_delivery|intval}"><a class="ajax_cart_block_remove_link" href="{$link->getPageLink('cart', true, NULL, "delete=1&id_product={$product.id_product|intval}&ipa={$product.id_product_attribute|intval}&id_customization={$id_customization}&token={$static_token}", true)|escape:'html'}" rel="nofollow"> </a></div>
							<span class="quantity-formated"><span class="quantity">{$customization.quantity}</span>x</span>{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)}
							{$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|replace:"<br />":" "|truncate:28:'...'|escape:html:'UTF-8'}
							{else}
							{l s='Customization #%d:' sprintf=$id_customization|intval mod='blockcart'}
							{/if}
						</li>
					{/foreach}
				</ul>
				{if !isset($product.attributes_small)}</dd>{/if}
			{/if}

			{if isset($product.attributes_small)}</dd>{/if}

		{/foreach}
		</dl>
	{/if}
		<p {if $products}class="hidden"{/if} id="cart_block_no_products">{l s='No products' mod='blockcart'}</p>
		{if $discounts|@count > 0}
		<table id="vouchers"{if $discounts|@count == 0} style="display:none;"{/if}>
			{foreach from=$discounts item=discount}
				{if $discount.value_real > 0}
				<tr class="bloc_cart_voucher" id="bloc_cart_voucher_{$discount.id_discount}">
					<td class="quantity">1x</td>
					<td class="name" title="{$discount.description}">{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'}</td>
					<td class="price">-{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}</td>
					<td class="delete">
						{if strlen($discount.code)}
							<a class="delete_voucher" href="{$link->getPageLink('$order_process', true)}?deleteDiscount={$discount.id_discount}" title="{l s='Delete' mod='blockcart'}" rel="nofollow"><img src="{$img_dir}icon/delete.gif" alt="{l s='Delete' mod='blockcart'}" class="icon" /></a>
						{/if}
					</td>
				</tr>
				{/if}
			{/foreach}					
		</table>
		{/if}
		<p id="cart-prices">
			<span id="cart_block_shipping_cost" class="price ajax_cart_shipping_cost">{$shipping_cost}</span>
			<span>{l s='Shipping' mod='blockcart'}</span>
			<br/>
			{if $show_wrapping}
				{assign var='cart_flag' value='Cart::ONLY_WRAPPING'|constant}
				<span id="cart_block_wrapping_cost" class="price cart_block_wrapping_cost">{if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false, $cart_flag)}{else}{convertPrice price=$cart->getOrderTotal(true, $cart_flag)}{/if}</span>
				<span>{l s='Wrapping' mod='blockcart'}</span>
				<br/>
			{/if}
			{if $show_tax && isset($tax_cost)}
				<span id="cart_block_tax_cost" class="price ajax_cart_tax_cost">{$tax_cost}</span>
				<span>{l s='Tax' mod='blockcart'}</span>
				<br/>
			{/if}
			<span id="cart_block_total" class="price ajax_block_cart_total">{$total}</span>
			<span>{l s='Total' mod='blockcart'}</span>
		</p>
		{if $use_taxes && $display_tax_label == 1 && $show_tax}
			{if $priceDisplay == 0}
				<p id="cart-price-precisions">
					{l s='Prices include tax.' mod='blockcart'}
				</p>
			{/if}
			{if $priceDisplay == 1}
				<p id="cart-price-precisions">
					{l s='Prices do not include tax.' mod='blockcart'}
				</p>
			{/if}
		{/if}
		<p id="cart-buttons">
			{if $order_process == 'order'}<a href="{$link->getPageLink("$order_process", true)|escape:'html'}" class="button_small" title="{l s='View my shopping cart' mod='blockcart'}" rel="nofollow">{l s='Cart' mod='blockcart'}</a>{/if}
			<a href="{$link->getPageLink("$order_process", true)|escape:'html'}" id="button_order_cart" class="exclusive{if $order_process == 'order-opc'}_large{/if}" title="{l s='Checkout' mod='blockcart'}" rel="nofollow"><span></span>{l s='Checkout' mod='blockcart'}</a>
		</p>
	</div>
	</div>
</div>
<!-- /MODULE Block cart -->
Link to comment
Share on other sites

I'm sorry to insist on this topic but I can't solve it without a further confirmation of the above suggestion. I believe some little attention would just turn this 3D into a [closed] one.

 

The code from blockuserinfo.tpl is similar to one in blockcart.tpl. Similar but not the same, so I don't know where to insert it, or what part I should overwrite. There are <div> tags and <li> tags, and the solution is not so intuitive for a non-php developer like me.

So, again, I insist asking for a confirmation to the above solution given by Vekia: how do I insert code A into code B ?

 

Code A

		{if !$PS_CATALOG_MODE}
		<li id="shopping_cart">
			<a href="{$link->getPageLink($order_process, true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">{l s='Cart' mod='blockuserinfo'}
			<span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span>
			<span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='Product' mod='blockuserinfo'}</span>
			<span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Products' mod='blockuserinfo'}</span>
			<span class="ajax_cart_total{if $cart_qties == 0} hidden{/if}">
				{if $cart_qties > 0}
					{if $priceDisplay == 1}
						{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
						{convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)}
					{else}
						{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
						{convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)}
					{/if}
				{/if}
			</span>
			<span class="ajax_cart_no_product{if $cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span>
			</a>
		</li>
		{/if}

Code B

	<div id="cart_block_summary" class="{if isset($colapseExpandStatus) && $colapseExpandStatus eq 'expanded' || !$ajax_allowed || !isset($colapseExpandStatus)}collapsed{else}expanded{/if}">
		<span class="ajax_cart_quantity" {if $cart_qties <= 0}style="display:none;"{/if}>{$cart_qties}</span>
		<span class="ajax_cart_product_txt_s" {if $cart_qties <= 1}style="display:none"{/if}>{l s='Products' mod='blockcart'}</span>
		<span class="ajax_cart_product_txt" {if $cart_qties > 1}style="display:none"{/if}>{l s='Product' mod='blockcart'}</span>
		<span class="ajax_cart_total" {if $cart_qties == 0}style="display:none"{/if}>
			{if $cart_qties > 0}
				{if $priceDisplay == 1}
					{convertPrice price=$cart->getOrderTotal(false)}
				{else}
					{convertPrice price=$cart->getOrderTotal(true)}
				{/if}
			{/if}
		</span>
		<span class="ajax_cart_no_product" {if $cart_qties != 0}style="display:none"{/if}>{l s='(empty)' mod='blockcart'}</span>
	</div>

Link to comment
Share on other sites

i missed your replies (a lot of other topic on board!)

 

let's clarify what you're trying to achieve

 

mFP3zPQ.png

 

 

you wan tto move cart bloc kto the top of the right column, right?

 

i have to admit that:

EuMQ4GZ.png

 

this is not a cart. cart block appears when you've got products in cart, and move mouse over this block. by default.

 

the question is:

you want to move this feature to the right column, or just move the blok cart module to the right column?

Link to comment
Share on other sites

Hi Vekia, good you are back here and available for some help. B)

As you say, the cart becomes a real cart when products are added. What I'd like is that the cart in its "inactive/active" state, with its mousehover capability (i.e. like in the new image attached), is moved to the right column. In other words, it has to disappear from the header and stay on the right column even if it is empty of products.

post-85445-0-21729000-1394660833_thumb.jpg

Edited by Enoteca (see edit history)
Link to comment
Share on other sites

so, basically you want to move real cart block to the right column.

go to modules > positions search for displayTop modules list and REMOVE block cart form this modules listing.

then click on transplant button, and attach block cart module to the displayRightColumn hook.

Link to comment
Share on other sites

You see, I have tried that solution already but it is not giving the result I wish, because the empty white cart block is still in the header and it has lost the mousehover effect, while the new block shows what was normally hidden.  See new attachment.

post-85445-0-96018000-1394742739_thumb.jpg

Link to comment
Share on other sites

ok, so:

gwg1FCq.png

as i probably already mentioned - it's not a cart block module, it's a part of blockuserinfo module.

so, in this case please open module file: blockuserinfo.tpl (remember that if this file exists in theme dir - you have to modify this one) and remove this code:

	<ul id="header_nav">
		{if !$PS_CATALOG_MODE}
		<li id="shopping_cart">
			<a href="{$link->getPageLink($order_process, true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">{l s='Cart' mod='blockuserinfo'}
			<span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span>
			<span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='Product' mod='blockuserinfo'}</span>
			<span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Products' mod='blockuserinfo'}</span>
			<span class="ajax_cart_total{if $cart_qties == 0} hidden{/if}">
				{if $cart_qties > 0}
					{if $priceDisplay == 1}
						{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
						{convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)}
					{else}
						{assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant}
						{convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)}
					{/if}
				{/if}
			</span>
			<span class="ajax_cart_no_product{if $cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span>
			</a>
		</li>
		{/if}
		<li id="your_account"><a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" rel="nofollow">{l s='Your Account' mod='blockuserinfo'}</a></li>
	</ul>

now you want:

XegvqLM.png

 

so,

1) go to modules > positions and transplant cart block to the right column.

2) remove cart block module from displayTop modules list (not displayHeader!)

 

but problematic thing is:

muwMzmJ.png

 

if you don't want to show cart until a product is added - it mean that cart will be invisible, so how you want "mouseover" on not displayed block? It's not possible! :)

Link to comment
Share on other sites

We are getting somewhere, thank you. I finally see the cart not in the header anymore.

 

I do want to show the cart, also if no product is added, and I'm fine with the mouseover effect only when products are in the cart....  this is actually the default behaviour of the cartblock.

Now I just want the cart (as part of the blockuserinfo module) to appear on the right column as it is (i.e. an icon on a white space) and not as a "always visible" layout. 

 

I hope I have explained myself well. Do you think it's possible?

Edited by Enoteca (see edit history)
Link to comment
Share on other sites

 

I do want to show the cart, also if no product is added, and I'm fine with the mouseover effect only when products are in the cart....  this is actually the default behaviour of the cartblock.

Now I just want the cart (as part of the blockuserinfo module) to appear on the right column as it is (i.e. an icon on a white space) and not as a "always visible" layout. 

 

yes, that's right, its default behaviour, but it's worth to notice that mouse over effect works on:

brfxD83.png

 

it's not cart block module but it's a blockuserinfo module. without this element, "mouseover" will not work because it just isn't available

Link to comment
Share on other sites

So, are you saying that because I moved part of blockuserinfo (i.e. the welcome/login/logout links) inside tophorizontalmenu, then the effect is not working? But I confirm you that it is  working as long as the cart empty stays in the header.

How come I cannot have just the cart empty in the right column with the same layout as it is in the header? I have tried to move the code above from blockuserinfo.tpl and have inserted it in theme/footer.tpl, just before the hook:

<div id="right_column" class="column grid_2 omega">
<ul id="header_nav"> ......  </ul>
{$HOOK_RIGHT_COLUMN}
</div>

Doing so, the empty cart appears in the right place but of course the mouseover doesn't work.

There must be a workaround...  :ph34r: 

Edited by Enoteca (see edit history)
Link to comment
Share on other sites

this Cart is really a nightmare for me! Now it has moved just by its own while I was modifying other things and it is on the bottom of the header. Moving it above the Tophorizontalmenu is to no avail.

It is actually hooked both in DisplayHeader and DisplayTop, and just above Blockuserinfo, but it doesn't look so anymore. What has happened? How can I put it back to where it was, i.e. in the header?

post-85445-0-99234400-1396184370_thumb.jpg

Edited by Enoteca (see edit history)
Link to comment
Share on other sites

I'm trying all possible things but my cart wont go back to the top...

it's in DisplayHeader and DisplayTop, and above the tophorizontalmenu, and the mousehover effect showing what's inside the cart is always starting from its original position, but the cart is positioned below. Why ?

Edited by Enoteca (see edit history)
Link to comment
Share on other sites

  :angry: this topic has been of no use. Now I wish to have things at least reverted as they were but cannot see the cart block inside the header.

Here I go again: codewise, cartblock is inside both DisplayHeader and DisplayTop, but layoutwise it is 148px below its original position, i.e. the position from where the mousehover effect showing what's inside the cart begins.

Please browse www.mondodellabirra.com, try to add procucts and see the problem. Come on, let's close this topic :wacko: once for all.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...