-
Re: Shoppingcart/Freeship in Header support
Hi
I totally forgot about reading about that...
I've fixed that up and I've added text-align: center in my #cartHeader so all will be center... Just a few dress ups here and there but now I need to ad a link in between shipping qualify and the checkout button for a 'Some restrictions apply' link...
And then done... my boss likes it which is a :bigups:...
Thanks again for your help!!!!
-
Re: Shoppingcart/Freeship in Header support
Looking good! Since you have subtle rounded corners on many of your freestanding boxes, you might want to do the same for this. In all modern browsers (not including IE8 and older) these declarations added to #cartHeader {} will do it:
Code:
-moz-border-radius: .7em;
-webkit-border-radius: .7em;
border-radius: .7em;
-
Re: Shoppingcart/Freeship in Header support
Hey... you are amazing.... thanks I just added that in...:clap:
I really need to figure out how to add that url ref. in tpl_cart_header.php for the 'Some restrictions apply' link.
I can't figure out to add a url in php.... :frusty:
Any ideas???
-
Re: Shoppingcart/Freeship in Header support
or do I have to call it from another file that has the URL?
-
Re: Shoppingcart/Freeship in Header support
What kind of page is your text on? If it is a define page or one that has its own pagename, you can use
<a href="/index.php?main_page=whatever" >Some restrictions apply</a>
If it is an ez-page, use
<a href="<?php echo zen_ez_pages_link(23) ?>" >Some restrictions apply</a>
where 23 is replaced by your ez-page id.
-
Re: Shoppingcart/Freeship in Header support
Beauty... thanks
I was stumped with echo command and couldn't figure it out until this morning... I guess a fresh clear mind is all you need...
I got it working now and its complete...
For anyone that wants to see it in action here's the link:
http://store.printersparts.com/store/
Thanks again! :yes:
-
Re: Shoppingcart/Freeship in Header support
I'm trying to figure out how to hide the header cart on the shopping cart and checkout pages and after hours of combing the forums, haven't been able to come up with an answer. (I found a couple of similar questions, but they just said they "fixed it". Grrr!)
So far, I've tried adding
PHP Code:
<?php
if ($this_is_shopping_cart) {
echo TEXT_CART;
}
else{
require($template->get_template_dir('tpl_cart_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_cart_header.php');
}
?>
in tpl_header.php and then defining TEXT_CART without text (a sad attempt at a workaround, I know) but the cart still displays on the shopping cart page.
I would REALLY appreciate any assistance that you can lend.
I'm using Zen Cart v. 1.3.9f
Site Link: theburningbutterfly.com/shop
Mods installed: pretty much every mod known to Zen Cart and then some
Thanks in advance!
Crystal
-
Re: Shoppingcart/Freeship in Header support
The home page is the only one that has a $this_is_ variable tracking it. All other pages need to use something like
PHP Code:
if($current_page_base != 'shoppingcart'){
require($template->get_template_dir('tpl_cart_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_cart_header.php');
}
"if $current_page_base is not equal to 'shoppingcart'... "
-
Re: Shoppingcart/Freeship in Header support
For the whole set of pages, something like
PHP Code:
if(!in_array($current_page_base, explode(',', 'shoppingcart,checkout_shipping,checkout_whatever,checkout_success'){
require($template->get_template_dir('tpl_cart_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_cart_header.php');
}
-
Re: Shoppingcart/Freeship in Header support
Woot! Woot! Thanks so much! I would have never thought to use that statement.
After playing around with it a little, the statement that I used to make the Shopping Cart in the header not appear on the shopping cart and check out pages is:
PHP Code:
<?php
if (!in_array($current_page_base,explode(",",'shopping_cart,checkout,checkout_confirmation,fec_confirmation')) )
require ($template->get_template_dir('tpl_cart_header.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_cart_header.php');?>
I just put it in my tpl_header.php file where the original shopping cart code was.
Thanks again - you rock!
-
Re: Shoppingcart/Freeship in Header support
rxalex - post your specific needs here and I will advise you.
-
Re: Shoppingcart/Freeship in Header support
How do I re-align the box to be smaller vertically?
-
Re: Shoppingcart/Freeship in Header support
I looked all over in this thread and can't seem to find an answer for what I think is a very simple question. I want to change the default graphic that shows up in the header to "checkout" when an item is added to the cart. I thought I maybe needed to just change the "CHCKOUT" part of BUTTON_IMAGE_CHECKOUT in tpl_cart_header.php on this line to whatever image it is I want it to hit. But that does not work. How do I select a checkout logo that is just for my header cart??
Code:
<?php
if ($cart_count) {
echo '<div id="cartCheckout"><a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT) . '</a></div>';
} ?>
Also, I would like to get rid of the "totals" in the cart completely. Again, I haven't found out how to do that. Any help?
-
Re: Shoppingcart/Freeship in Header support
zen_image_button(BUTTON_IMAGE_CHECKOUT)
This uses the filename defined for BUTTON_IMAGE_CHECKOUT; to use another file without changing the regular button elsewhere, you would need to use a different constant name and define that constant to be the desired filename. Something like
zen_image_button(BUTTON_IMAGE_CART_HEADER_CHECKOUT)
and put a define in a language file like
define('BUTTON_IMAGE_CART_HEADER_CHECKOUT', 'yourbuttonimage.gif');
Pattern the define after the define for BUTTON_IMAGE_CHECKOUT.
-
Re: Shoppingcart/Freeship in Header support
Excellent - I was able to fix that! Thank you so much! :smile:
-
Re: Shoppingcart/Freeship in Header support
I made some adjustments to my site text and it threw my header off. Now my image for my cart is cut off on the right side. When something is in the cart it shows completely. Any suggestions? squishytushy.com
thanks!
-
Re: Shoppingcart/Freeship in Header support
Odd... I can only get the cut-off border/image on the product info page.
You appear to have slightly different rules for product info and for other pages.
product info:
min?f=...2619730 (line 113)
#cartHeader {
background: url("/includes/templates/future_zen/images/cartheader.jpg") no-repeat scroll 0 0 transparent;
padding: 0 2em 1em 0;
position: absolute;
right: 2.9em;
top: 1em;
}
other pages:
min?f=...2619730 (line 113)
#cartHeader {
background: url("/includes/templates/future_zen/images/cartheader.jpg") no-repeat scroll 0 0 transparent;
padding: 0 2em 1em 0;
position: absolute;
right: 0;
top: 0.1em;
}
I don't yet know why or how this would be happening - that may take some digging, and minimized stylesheets are a real pain to sift through.
-
Re: Shoppingcart/Freeship in Header support
I really can't see any reason for this to happen. In both cases, the same stylesheets are being used, and the location and surroundings of that rule look the same. It just has different position spacings for the two cases. Since I can't find anything else, I will guess that the css/js loader that minifies the files masks whatever is causing the difference, or maybe causes the difference itself.
-
Re: Shoppingcart/Freeship in Header support
Hi Glenn,
Great mod, thanks!
We only offer free shipping in the UK; can this module be changed so that the amount needed to qualify will only show in the box for UK customers and be hidden for those that don't get free shipping?
-
Re: Shoppingcart/Freeship in Header support
Yes, with some new custom coding. You would need some code to detect where the customer is located; then you could switch the free shipping section on or off accordingly. User locale detection is not something I have worked with, so you would need someone to advise on how best to do that. If the user is logged in, it becomes easy to check if the address is in the UK.
-
Re: Shoppingcart/Freeship in Header support
I'm new and I have been staring at this for way too long.
So far, I like the shoppingcart/free ship modification. However, I would like the content displayed to replace the content of the current shopping cart side box instead of being part of the header.
How would I go about doing this?
Thanks!
-
Re: Shoppingcart/Freeship in Header support
The mod was originally adapted and extended from the Free Shipping Qualifier Sidebox mod, so you should be able to put this mod's code back into the sidebox shell of the other mod.
-
Re: Shoppingcart/Freeship in Header support
I considered that, but was not able to figure out which code needed to stay (for turning the sidebox on and off via the control panel) and which code needed to be replaced. I am sure it is fairly straight forward, but I am not familiar enough with PHP yet to figure it out quickly.
Any help would be appreciated.
-
Re: Shoppingcart/Freeship in Header support
Ok, last time - I promise.
I have a .png background on the cart header which displays perfectly in Chrome but in Firefox, there is a five pixel gap on the right side. It looks to me like Firefox is seeing the entire image but Chrome isn't (there's a five pixel transparent shadow around the image). Do you know if there is any way to fix it so they look the same? I've been "googleing" for a while and can't find the answer.
Site link: burningbutterfly.com
Thanks in advance.
-
Re: Shoppingcart/Freeship in Header support
I took a quick look in FF and see the stripy edge that you are probably talking about. I don't have Chrome so can't check that.
I am about to leave for a business trip, but will try to look into it next week when I return, to see what is actually happening.
-
Re: Shoppingcart/Freeship in Header support
Thanks Glenn - it's not a huge deal, so no hurry. I wouldn't bug you about it, but you're the css master :) Don't forget to have a little fun on your trip!
-
Re: Shoppingcart/Freeship in Header support
Quote:
Originally Posted by
gjh42
I took a quick look in FF and see the stripy edge that you are probably talking about. I don't have Chrome so can't check that.
I am about to leave for a business trip, but will try to look into it next week when I return, to see what is actually happening.
I finally figured out what was causing the gap - I had unnecessary relative and absolute positions in my stylesheet. (I didn't realize that all browsers rendered those tags differently.) Once I took out the ones that weren't pertinent, the cart in my header started to behave itself.
Thanks again for all your help.
-
Re: Shoppingcart/Freeship in Header support
-
Re: Shoppingcart/Freeship in Header support
-
Re: Shoppingcart/Freeship in Header support
The tpl_header.php file has changed for v1.5.1, so you will need to use that as the base file to insert the cart call, as the readme describes for cases of a previously customized tpl_header.php.
The original mod will work as is for v1.5.0 or older.
I have updated the mod to use the new file version, and it should be available soon in Plugins.
-
Re: Shoppingcart/Freeship in Header support
This mod is a perfect additon to zen and I have used it on 1.5.0. I ship nationally and overseas. I also have the shipping estimator option showing within the cart (not as a separate pop-up). Therefore, users see shipping when in the cart and can choose their location.
Is there a way to modify the code so that the 'add $$ to cart to qualify for free shipping etc' only appears when the national (and default location) is picked in the estimator and is removed when a customer picks another (overseas/international) location?
Might be a tall order. I notice, however, that the module must link to Orders Total Modules > Shipping since it is in here that the relevant value for Free Shipping is set. That page also has a value for where free shipping is applicable: national, international, both - so there may be scope?
Any ideas?
-
Re: Shoppingcart/Freeship in Header support
The mod doesn't need to link into any shipping modules; it just uses values/constants set by them. It would probably be possible to use or look up the customer's country if it is set... I don't know about the estimator, whether the setting there is accessible. If it is set by javascript, it would likely not be accessible to the PHP code that operates the header mod.
-
Re: Shoppingcart/Freeship in Header support
Glenn (or any Zen Cart guru),
I am trying to modify the "Shoppingcart/Freeship" in Header to include product name (productsName) and product image (productsImage). I have installed it in a dropdown menu. It looks good and functions nicely.
I have tried to modify the php in "Shoppingcart/Freeship in Header" to display the product name and product image but cannot seem to do it. I am not very familiar with php. I am able to position things with divs and css. I am able to pull code out of the shopping cart page but when I install it in the plugin it only works in the dropdown menu on the shopping cart page. I would like it to display $0.00 and 0 Items like it does when the cart is empty. I
Here is an example http://www.graphiclabtees.com/. I believe that this is a wp site, however if you add something to the cart, you can see how it displays in the dropdown.
Any help or information would be appreciated. I like the plugin, I would just like to display a little more information.
Thanks you in advance.
-
Re: Shoppingcart/Freeship in Header support
The reason your transplanted code works on the shopping cart page and not elsewhere is probably that it uses database lookups generated for that page, and not for other pages. You would need to do a database lookup for the information you want, in the mod files so it will always be available. Check /includes/modules/pages/shopping_cart/main_template_vars.php, which is likely to be the place where this db lookup is performed for the cart page. This should serve as an example for the SQL you need.
-
Re: Shoppingcart/Freeship in Header support
Glenn,
Thanks for the information. I checked for /includes/modules/pages/shopping_cart/main_template_vars.php. There was no main_template_vars.php in that folder. I did find a main_template_vars.php file in the /includes/modules/pages/product info folder. I looked at the code but couldn't figure it out.
Is there some code that can be inserted into your plugin that would display the product name and product image. I am not sure what is needed to call this information. Is this some major php coding? I have been looking into this for a few days now without any luck. I'm sure the information you gave me points me in the right direction, but not being familiar with php, I really have no idea how to get this done. It may be harder than I think.
Can you give me a brief explanation of what needs to be done? I am going to pose the question and code below, if another Zen Cart Guru comes across this post and is able to help.
To see the plugin on my site, visit www.4twentee.com. The dropdown menu is in the main nav under Shopping Cart.
Thanks Again,
Jesse
How can I display product name (productsName) and product image (productsImage) in "Shoppingcart/Freeship in Header" plugin?
<?php
/**
* tpl_cart_header.php
* @copyright Copyright 2012 Glenn Herbert
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.gnu.org/licenses/ GNU Public License V3.0
* /includes/templates/your_template/templates/tpl_cart_header.php
* Shoppingcart/Freeship in Header - Glenn Herbert (gjh42) - 2012-11-20
*/
$cart_count = $_SESSION['cart']->count_contents();
?>
<div id="cartHeader">
<?php echo ($cart_count? '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . CART_HEADER_TITLE . '</a>':CART_HEADER_TITLE); ?>
<div id="cartCount">
<?php
if ($cart_count) {
$_SESSION['cart']->get_products();
$basket_total = $_SESSION['cart']->show_total();
echo '<span id="cartTotal">' . CART_HEADER_TOTAL . $currencies->format($basket_total) . '</span><br />
' ;
}
echo ($cart_count? '':'') . CART_HEADER_IN_CART_PRE . $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULAR: CART_HEADER_IN_CART_PLURAL) . ($cart_count? '': '');
?>
</div>
<?php
if ($cart_count) {
echo '<div class="buttonRow back"><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_VIEW_CART, BUTTON_VIEW_CART_ALT) . '</a></div>';
echo '<div class="buttonRow forward"><a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a></div>';
} ?>
</div>
-
Re: Shoppingcart/Freeship in Header support
For the shopping cart page, the basic info is retrieved and massaged in /includes/modules/pages/shopping_cart/header_php.php.
PHP Code:
$products = $_SESSION['cart']->get_products();
This method is available anywhere as it is part of the $_SESSION superglobal.
Later in that file we have
PHP Code:
$productsImage = (IMAGE_SHOPPING_CART_STATUS == 1 ? zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) : '');
which shows that the image and name are accessible as $products[$i]['image'] and $products[$i]['name']. You need to loop through $products incrementing $i (or whatever variable) and pulling the name and image for each, and putting them in a custom array or outputting them, or whatever you want to do.
-
Re: Shoppingcart/Freeship in Header support
You would want to use a different variable name than $products so as not to conflict with the existing instance of it, maybe $cart_header_products.
-
Re: Shoppingcart/Freeship in Header support
Glenn,
I appreciate your feedback. I am going to give this a shot. I took this code from the shopping cart and modified it. I changed $products to $cart_header_products. Do I have to define this somewhere?
I added this to my code. It shows in the shopping cart page but nowhere else.
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartHeaderDisplay">
<?php
foreach ($productArray as $cart_header_products) {
?>
<tr class="<?php echo $cart_header_['rowClass']; ?>">
<td class="cartProductDisplay">
<a href="<?php echo $cart_header_products['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $cart_header_products['productsImage']; ?></span><span id="cartProdTitle"><?php echo $cart_header_products['productsName'] . '<span class="alert bold">' . $cart_header_products['flagStockCheck'] . '</span>'; ?></span></a>
</td>
</tr>
<?php
} // end foreach ($productArray as $cart_header_products)
?>
<!-- Finished loop through all products /-->
</table>
-
Re: Shoppingcart/Freeship in Header support
Just using $productArray makes you dependent on the shopping cart page code. You need to get it directly from $_SESSION:
PHP Code:
$cart_header_products = $_SESSION['cart']->get_products();
Then you can iterate through $cart_header_products, putting the name and image of each item in your output.
-
Re: Shoppingcart/Freeship in Header support
Glenn,
This is what I came up with. I am not sure how to add the array. I tried to use the code from your plugin as an example, but this is not working. Am I on the right track? The code after echo is from the shopping cart page using $cart_header_products.
<?php
if ($cart_count) {
$cart_header_products = $_SESSION['cart']->get_products();
echo <a href="<?php echo $cart_header_products['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $cart_header_products['productsImage']; ?></span><span id="cartProdTitle"><?php echo $cart_header_products['productsName'] . '<span class="alert bold">' . $cart_header_products['flagStockCheck'] . '</span>'; ?></span></a>;
}
?>
-
Re: Shoppingcart/Freeship in Header support
First off, you need to address the product data with the right number of fields: not
$cart_header_products['linkProductsName']
but
$cart_header_products[$item]['linkProductsName']
so you can output each item's data in turn.
You need to use class= and not id= for the tags, since they will be repeated.
You need to iterate through the products, as the foreach in your previous post did. Foreach has complex behavior that can make it hard to use right without some testing on the particular subject; a simple for() statement will be more reliable here even if it is theoretically less efficient.
The code posted is a mixture of HTML with PHP insertions, and PHP with HTML output strings. It would be clearer to go to all one style, as shown below.
PHP Code:
$cart_header_products = $_SESSION['cart']->get_products();
for ($item=0; $item<sizeof($cart_header_products); $item++) {
echo '<a href="' . $cart_header_products[$item]['linkProductsName'] . '"><span class="cartImage" class="back">' . $cart_header_products[$item]['productsImage'] . '</span><span class="cartProdTitle">' . $cart_header_products[$item]['productsName'] . '<span class="alert bold">' . $cart_header_products[$item]['flagStockCheck'] . '</span></span></a>' . "\n";
}
-
Re: Shoppingcart/Freeship in Header support
Glenn,
I tried using the code that you provided but I couldn't get it to work. Can you be more specific about what needs to be done? I'm sure that you provided the information necessary, but I am not well versed in php.
Can you include the entire code that needs to be installed and where? Or could I add this to a wish list for Shoppingcart/Freeship in Header plugin?
I want to show the product name and product image below the "Shopping Cart" header and above the Sub-Total in the dropdown. I would like to add the quantity of the individual product also if possible.
Your plugin works great. I do have it installed, but it would be more functional and look better with the product name and image displayed. Check it out on my site www.4twentee.com (add a product to the shopping cart first and hover over the Shopping Cart menu tab). I understand that the plugin is designed to display in the header or sidebox, and this added function would not fit well.
Thanks again for answering my posts.
-
Re: Shoppingcart/Freeship in Header support
Seeing the way you want to display this, it makes more sense. The usual header location would not hold a variable number of item displays comfortably, but the dropdown from the tab will.
Try this (adding the part between // products comments)
PHP Code:
* /includes/templates/your_template/templates/tpl_cart_header.php
* Shoppingcart/Freeship in Header - Glenn Herbert (gjh42) - 2012-11-20 ========== modified to show products 20130102
*/
$cart_count = $_SESSION['cart']->count_contents();
?>
<div id="cartHeader">
<h3><?php echo ($cart_count? '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . CART_HEADER_TITLE . '</a>':CART_HEADER_TITLE); ?></h3>
<div id="cartCount">
<?php
if ($cart_count) {
//bof products
$cart_header_products = $_SESSION['cart']->get_products();
define('CART_PRODUCT_QTY_PRE', ' (');//put in cart_header_defines.php
define('CART_PRODUCT_QTY_POST', ') ');//put in cart_header_defines.php
echo '<div id="cartProducts">';
for ($item=0; $item<sizeof($cart_header_products); $item++) {
echo '<a href="' . $cart_header_products[$item]['linkProductsName'] . '"><span class="cartProdImage">' . $cart_header_products[$item]['productsImage'] . '</span><span class="cartProdQty">' . CART_PRODUCT_QTY_PRE . $cart_header_products[$item]['quantityField'] . CART_PRODUCT_QTY_POST . '</span><span class="cartProdTitle">' . $cart_header_products[$item]['productsName'] . '<span class="alert bold">' . $cart_header_products[$item]['flagStockCheck'] . '</span></span></a>' . "\n";
}
echo '</div>';
//eof products
//$_SESSION['cart']->get_products(); //?not needed after products code?
$basket_total = $_SESSION['cart']->show_total();
-
Re: Shoppingcart/Freeship in Header support
Glenn,
I added the code but the product name and image are not displaying. All that is showing is this "()" and it links to the index page. I will leave the code in so you can see what it is doing.
Do I have to define these?
define('CART_PRODUCT_QTY_PRE', ' (');//put in cart_header_defines.php
define('CART_PRODUCT_QTY_POST', ') ');//put in cart_header_defines.php
The entire code that I have in tpl_cart_header.php is below. I don't know how to add code to the forum like you did above. Is there a button to do that?
<?php
/**
* tpl_cart_header.php
* @copyright Copyright 2012 Glenn Herbert
* @copyright Portions Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.gnu.org/licenses/ GNU Public License V3.0
* /includes/templates/your_template/templates/tpl_cart_header.php
* Shoppingcart/Freeship in Header - Glenn Herbert (gjh42) - 2012-11-20
*/
$cart_count = $_SESSION['cart']->count_contents();
?>
<div id="cartHeader">
<h3><?php echo ($cart_count? '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . CART_HEADER_TITLE . '</a>':CART_HEADER_TITLE); ?></h3>
<div id="cartCount">
<?php
if ($cart_count) {
$cart_header_products = $_SESSION['cart']->get_products();
define('CART_PRODUCT_QTY_PRE', ' (');//put in cart_header_defines.php
define('CART_PRODUCT_QTY_POST', ') ');//put in cart_header_defines.php
echo '<div id="cartProducts">';
for ($item=0; $item<sizeof($cart_header_products); $item++) {
echo '<a href="' . $cart_header_products[$item]['linkProductsName'] . '"><span class="cartProdImage">' . $cart_header_products[$item]['productsImage'] . '</span><span class="cartProdQty">' . CART_PRODUCT_QTY_PRE . $cart_header_products[$item]['quantityField'] . CART_PRODUCT_QTY_POST . '</span><span class="cartProdTitle">' . $cart_header_products[$item]['productsName'] . '<span class="alert bold">' . $cart_header_products[$item]['flagStockCheck'] . '</span></span></a>' . "\n";
}
echo '</div>';
$basket_total = $_SESSION['cart']->show_total();
echo '<span id="cartTotal">' . CART_HEADER_TOTAL . $currencies->format($basket_total) . '</span><br />
' ;
}
echo ($cart_count? '':'') . CART_HEADER_IN_CART_PRE . $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULAR: CART_HEADER_IN_CART_PLURAL) . ($cart_count? '': '');
?>
</div>
<?php
if ($cart_count) {
echo '<div class="buttonRow back"><a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_VIEW_CART, BUTTON_VIEW_CART_ALT) . '</a></div>';
echo '<div class="buttonRow forward"><a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a></div>';
} ?>
</div>
-
Re: Shoppingcart/Freeship in Header support
The code is executing properly, except that the array fields are empty. Let's try some debugging to see exactly what is there...
Add after this line
$cart_header_products = $_SESSION['cart']->get_products();
var_dump($cart_header_products);//debug
Once the code is working, the defines ought to move to the file mentioned for orderliness. It doesn't matter now.
-
Re: Shoppingcart/Freeship in Header support
I have done this on my local test site, and find that the array field names are quite different from the ones in your transplanted code snippet that I started from. The relevant fields:
Code:
$cart_header_products = $_SESSION['cart']->get_products();
//relevant fields
["id"]=> int(19)
["category"]=> string(2) "12"
["name"]=> string(35) "There's Something About Mary Linked"
["image"]=> string(35) "dvd/theres_something_about_mary.gif"
["quantity"]=> int(1)
Substituting these in the echo code gives this output:
Quote:
dvd/theres_something_about_mary.gif (1) There's Something About Mary Linked
which with further massaging to use the info correctly will give the link to each product with its image, quantity and name.
-
Re: Shoppingcart/Freeship in Header support
The shopping cart page was apparently using its own array to hold this info and much more, with its own terminology, which does not match the terminology used in the $_SESSION content. At any rate, we're on the way...
-
Re: Shoppingcart/Freeship in Header support
I am sure that you already know this, I just want to let you know I am here doing what I can. Mostly inserting the code that you are providing and testing what happens.
This is what the dropdown is showing after adding this code, var_dump($cart_header_products);//debug.
array(1) { [0]=> array(17) { ["id"]=> string(34) "3:4f4ef1da0c407f06362a1c6ae9652e3b" ["category"]=> string(1) "2" ["name"]=> string(19) ""Shirt of the Week"" ["model"]=> string(0) "" ["image"]=> string(11) "sow/sow.jpg" ["price"]=> string(7) "10.0000" ["quantity"]=> int(1) ["weight"]=> int(1) ["final_price"]=> float(10) ["onetime_charges"]=> int(0) ["tax_class_id"]=> string(1) "1" ["attributes"]=> array(2) { [1]=> int(1) [2]=> int(4) } ["attributes_values"]=> string(0) "" ["products_priced_by_attribute"]=> string(1) "0" ["product_is_free"]=> string(1) "0" ["products_discount_type"]=> string(1) "0" ["products_discount_type_from"]=> string(1) "0" } }
()
-
Re: Shoppingcart/Freeship in Header support
Edit /includes/templates/your_template/templates/tpl_cart_header.php.
After
if ($cart_count) {
around line 17, replace the
$_SESSION['cart']->get_products();
with the following
PHP Code:
//bof products
$cart_header_products = $_SESSION['cart']->get_products();
echo '<div id="cartProducts">';
for ($item=0; $item<sizeof($cart_header_products); $item++) {
echo '<a href="' . zen_href_link(zen_get_info_page($cart_header_products[$item]['id']), 'products_id=' . $cart_header_products[$item]['id']) . '"><span class="cartProdImage">' . zen_image(DIR_WS_IMAGES . $cart_header_products[$item]['image']) . '</span><span class="cartProdQty">' . CART_PRODUCT_QTY_PRE . $cart_header_products[$item]['quantity'] . CART_PRODUCT_QTY_POST . '</span><span class="cartProdTitle">' . $cart_header_products[$item]['name'] . '</span></a>' . "\n";
}
echo '</div>';
//eof products
Edit /includes/languages/english/extra_definitions/your_template/cart_header_defines.php
and add
PHP Code:
define('CART_PRODUCT_QTY_PRE', ' (');//products display
define('CART_PRODUCT_QTY_POST', ') ');//products display
Adjust the defines as desired.
You can style
.cartProdImage ()
.cartProdQty ()
.cartProdTitle ()
in your stylesheet as desired for your layout.
-
Re: Shoppingcart/Freeship in Header support
Glenn,
I'm dialing it in. I have it set up but need help with one thing. The product image is too big. I would like to use the image (size) from the shopping cart. I tried inserting "productsImage" but it didn't quite work. It was displaying the proper size, but the image was not showing.
You can see what I've got so far. I rearranged some items. I will post all of the code and css that I have after we have it all set.
-
Re: Shoppingcart/Freeship in Header support
There are parameters you can add to zen_image() to specify the size... I will have to look up an example. I have other stuff to do now - be back later.
-
Re: Shoppingcart/Freeship in Header support
The image code used in the shopping cart page:
PHP Code:
zen_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT)
You could apply it in the cart header as
PHP Code:
zen_image(DIR_WS_IMAGES . $cart_header_products[$item]['image'], $cart_header_products[$item]['name'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT)
-
Re: Shoppingcart/Freeship in Header support
Glenn,
Your'e a Rock Star!
It works great. The shopping cart image was a little too big so I substituted SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT. Check out my site.
This is exactly what I was hoping for. Now that it is dialed in, I have a few more questions.
Is there a way to limit the number of products to display in the dropdown? I make my sites on an HP laptop. If I place more than 5 products in the shopping cart the dropdown reaches the bottom of the screen. If I add 6 or more products to the shopping cart the dropdown extends below the screen and the checkout button is not visible. Is there a way to limit the array(?) to four products and create a fifth item or output that says "More..."?
Can you help with adding the product attributes? I looked at the shopping cart to see how it is done, but cannot figure out how to adapt it to your plugin.
Thanks again!
-
Re: Shoppingcart/Freeship in Header support
Hi Glenn & JackOlive
I was following your conversations as I was looking to do exactly what jackolive was doing. Thank you Glenn for the solution that you have provided jackolive as it helped me as well. I was able to get an image of the product in the shopping cart drop down that I created, however - when I add more than 1 product and try to hover over the shopping cart link on the menu, the images and product titles, prices etc. are all over the place. Is there a way in CSS to control multiple products to display side by side? I tried searching on these forums as well as google but I can't seem to figure it out. Any help or direction will be appreciated.
Edited: I can't seem to provide the link to my production site as it is being built to sell adult novelties. If either of you can help, I can PM you the site link.
-
Re: Shoppingcart/Freeship in Header support
Is it not the site in your sig? If the forum obfuscates the actual link text, you can add spaces to break up the words.
It should be possible to alter the layout with CSS to fit whatever you want; some rearrangements may require moving PHP code to change output order.
-
Re: Shoppingcart/Freeship in Header support
Quote:
Is there a way to limit the number of products to display in the dropdown?
Yes, you can add a bit inside the for() loop.
PHP Code:
//bof products
$cart_header_products = $_SESSION['cart']->get_products();
echo '<div id="cartProducts">';
for ($item=0; $item<sizeof($cart_header_products); $item++) {
echo '<a href="' . zen_href_link(zen_get_info_page($cart_header_products[$item]['id']), 'products_id=' . $cart_header_products[$item]['id']) . '"><span class="cartProdImage">' . zen_image(DIR_WS_IMAGES . $cart_header_products[$item]['image'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT) . '</span><span class="cartProdQty">' . CART_PRODUCT_QTY_PRE . $cart_header_products[$item]['quantity'] . CART_PRODUCT_QTY_POST . '</span><span class="cartProdTitle">' . $cart_header_products[$item]['name'] . '</span></a>' . "\n";
if ($item >= 3) { //adjust to suit
echo '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">' . CART_HEADER_MORE . '</a>';
$item = sizeof($cart_header_products);
}
}
echo '</div>';
//eof products
Add to your define file
PHP Code:
define('CART_HEADER_MORE', 'More...');
Tested on my local site.
-
Re: Shoppingcart/Freeship in Header support
Quote:
Originally Posted by
gjh42
Is it not the site in your sig? If the forum obfuscates the actual link text, you can add spaces to break up the words.
It should be possible to alter the layout with CSS to fit whatever you want; some rearrangements may require moving PHP code to change output order.
Hi Glenn
The site in my signature is all set. I'm working on a new site for myself where I'm trying to add this functionality. The new site where I'm having this issue can be seen at www dot just - d i l d o.com / zencart. ** NOTE ** Site is being designed to sell adult novelty items.
-
Re: Shoppingcart/Freeship in Header support
Add to your stylesheet
Code:
#cartProducts>a {display: block; float: left; max-width: 12em; margin-right: 1em;}
-
Re: Shoppingcart/Freeship in Header support
Wow. Thank you for the quick response and solution.
-
Re: Shoppingcart/Freeship in Header support
where is the mod for this?
Ignore this I found it here http://www.zen-cart.com/downloads.php?do=file&id=990
Sorry
-
Re: Shoppingcart/Freeship in Header support
Fabulous mode, but I have a situation, I don't use the ot_shipping to offer free shipping, instead we use the freeoptions for which we have 3 different clones depending on regional, national and international. How could I display the message Add $XXX to your order to qualify for Free Shipping! revealing the freeoptions instead? I tried changing MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING to MODULE_SHIPPING_FREEOPTIONS but doesn't work.
Thanks for the help!
-
Re: Shoppingcart/Freeship in Header support
The structure of the free shipping is odd, probably because the freeoptions code was added after the freeshipper and took over some of its function, but the underlying code was never reoptimized.
In Modules > Order Total > Shipping, this is the setting page you should have:
Quote:
Shipping
This module is installed
true
Sort Order
Sort order of display.
[123] (whatever)
Allow Free Shipping
Do you want to allow free shipping?
( )true
(*)false
Free Shipping For Orders Over
Provide free shipping for orders over the set amount.
[50] (this number controls the freeship display calculations)
Set the amount, and "false" here.
Then in Modules > Shipping > Free Shipping Options
Quote:
Free Shipping Options
Enable Free Options Shipping
...
Do you want to offer per freeoptions rate shipping?
(*)True
( )False
Shipping Cost
The shipping cost will be $0.00
[0.00]
Handling Fee
Handling fee for this shipping method.
[0]
Total >=
Free Shipping when Total >=
[50] (this number controls the actual threshold)
Messy, and it ought to be cleaned up for future versions of both Zen Cart and this mod.
-
Re: Shoppingcart/Freeship in Header support
Thank you for the quick reply!
I see how it works and how it doesn't work with the freeoptions module.
Maybe I would need a work around.
Here is the situation. We offer 3 different free shipping options, a regional for michigan only on orders over $45, a national for the entire US on orders over $85, and to Canada for orders over $125.
So what we did was clone the freeoptions module to offer and trigger the 3 different options.
Since using the freeoptions modules instead of the ot_shipping is out of the question, I'm thinking maybe adding the other amounts would work?...
Something like "Add $XXX to your order to qualify for Free Shipping in Michigan, add $XXX to for Free Continental USA or add $XXX for Free Shipping to Canada"
Now I'm trying to figure out how to code this.
Any ideas??
-
Re: Shoppingcart/Freeship in Header support
Since the freeoptions setting is what actually controls the threshold, it would be best to recode the alert to use that (and its clones in your case). I haven't examined it in depth to see how to do that, but it should be feasible. If you want to look into it, that would be great, as I don't have much spare time right now.
-
Re: Shoppingcart/Freeship in Header support
It appears that /includes/modules/shipping/freeoptions.php uses MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN to determine the minimum price for free shipping to be offered. Substituting that in tpl_cart_header.php here might do the job:
PHP Code:
<?php
$free_ship_on = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
if ($free_ship_on == 'false') {
echo '<div id="cartFreeShip">';
$free_limit = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;//substitute MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN
if ($cart_count) {
-
Re: Shoppingcart/Freeship in Header support
Easier than I thought, so I'm sharing in case someone else needs a similar workaround.
Just for informative purposes.
I needed to display 3 different free shipping parameters as we offer free shipping over $45 for Michigan orders, over $85 for Continental US orders and over $125 for Canada. To set up the whole scenario we cloned the freeoptions.php module which I'm not explaining here how to do. There is plenty of info on how to accomplish this throughout the forum. Next we installed the Modules>Order Total>Shipping as explained above and set it up to false with the lowest free shipping amount we offer which is $45.
On the tpl_cart_header.php find
PHP Code:
<?php
$free_ship_on = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
if ($free_ship_on == 'false') {
echo '<div id="cartFreeShip">';
$free_limit = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
if ($cart_count) {
// $_SESSION['cart']->get_products();
$cart_total = $_SESSION['cart']->show_total();
if ($cart_total < $free_limit) {
$diff_to_free = ($free_limit - $cart_total);
echo CART_HEADER_DIFF_PRE . $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST;
} else {
echo CART_HEADER_QUALIFIES;
}
} else {
echo CART_HEADER_FREE_LIMIT_PRE . $currencies->format($free_limit) . CART_HEADER_FREE_LIMIT_POST;
}
echo '</div>';
} ?>
and replace for
PHP Code:
<?php
$free_ship_on = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
if ($free_ship_on == 'false') {
echo '<div id="cartFreeShip">';
$free_limit = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
if ($cart_count) {
// $_SESSION['cart']->get_products();
$cart_total = $_SESSION['cart']->show_total();
if ($cart_total < $free_limit) {
$diff_to_free = ($free_limit - $cart_total);
echo CART_HEADER_DIFF_PRE . $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST;
$diff_to_free = ($free_limit + '40.00' - $cart_total);
echo CART_HEADER_DIFF_PRE_CONT . $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST_CONT;
$diff_to_free = ($free_limit + '80.00' - $cart_total);
echo CART_HEADER_DIFF_PRE_CANADA . $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST_CANADA;
} else {
echo CART_HEADER_QUALIFIES;
}
} else {
echo CART_HEADER_FREE_LIMIT_PRE . $currencies->format($free_limit) . CART_HEADER_FREE_LIMIT_POST;
}
echo '</div>';
} ?>
We've commented the
PHP Code:
// $_SESSION['cart']->get_products();
as we don't want to display the entire list of products.
Next on cart_header_defines.php add the following
define ('CART_HEADER_DIFF_PRE_CONT',', ');
define ('CART_HEADER_DIFF_PRE_CANADA',' or ');
define ('CART_HEADER_DIFF_POST_CONT',' for Free Continental Shipping, ');
define ('CART_HEADER_DIFF_POST_CANADA',' for Free Shipping to Canada.');
Upload everything to the server.
The result is a message that looks like this for a shopping bag with $28
"Total: $28.00 (1 item)
Add $17.00 to qualify for Free Shipping in Michigan, $57.00 for Free Continental Shipping, or $97.00 for Free Shipping to Canada."
Hope this works for someone else.
-
Re: Shoppingcart/Freeship in Header support
Ah! We posted at the same time :)
Actually although your suggestion worked, it gives the wrong message when the cart has more than the minimum amount to trigger the first free shipping option.
It would need to trigger 3 different messages, one for "add $XXX for Michigan" until it reaches the michigan mark, another for when it passes the michigan mark "add $xxx for free continental shipping" until it reaches the continental mark and another for when it passes the continental mark "add $xxx for free shipping to canada" until it reaches the canada mark.
-
Re: Shoppingcart/Freeship in Header support
Just tested this and it does work, displaying and using the freeoptions setting for calculations.
So change this line in /includes/templates/your_template/templates/tpl_cart_header.php
PHP Code:
$free_limit = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER;
to
PHP Code:
$free_limit = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN;
Presumably your freeoptions clones have modified versions of this constant, so you would use those and an expanded text string to output them all as you described.
-
Re: Shoppingcart/Freeship in Header support
Got it! It works the same either way.
Thank you so much!
-
Re: Shoppingcart/Freeship in Header support
Read through your post and it looks like you have the mechanics of this well in hand. Thanks for posting the full directions.
Your situation does get complicated, as you can't say simply "you qualify for free shipping" without knowing which zone your customer is in. You would have to do some more sorting and output something like "you qualify for free shipping in Michigan; add $17.00 to qualify for Free Continental Shipping, or $57.00 for Free Shipping to Canada." as the case may be.
-
Re: Shoppingcart/Freeship in Header support
Yes, it's going to get a little complicated, but if it helps others, that's all it matters.
I'll post the final once I know it works.
Thanks for the help! =o)
-
Re: Shoppingcart/Freeship in Header support
Assuming you have constants for freeoptions and its clones like
MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN
MODULE_SHIPPING_FREEOPTIONS2_TOTAL_MIN
MODULE_SHIPPING_FREEOPTIONS3_TOTAL_MIN
you could do something like
PHP Code:
<?php
$free_ship_on = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
if ($free_ship_on == 'false') {
echo '<div id="cartFreeShip">';
$free_limit = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN; //mi
$free_limit2 = MODULE_SHIPPING_FREEOPTIONS2_TOTAL_MIN; //cont
$free_limit3 = MODULE_SHIPPING_FREEOPTIONS3_TOTAL_MIN; //canada
$diff_to_free = ($free_limit - $cart_total);
$diff_to_free2 = ($free_limit2 - $cart_total);
$diff_to_free3 = ($free_limit3 - $cart_total);
//if ($cart_count) { //hopefully this is not needed in order to evaluate $_SESSION['cart']->show_total() which can == 0 for this code
// $_SESSION['cart']->get_products(); //this was leftover from old code and has no current function in any case, so just delete it
$cart_total = $_SESSION['cart']->show_total();
if ($cart_total >= $free_limit3) {
echo CART_HEADER_QUALIFIES;
} elseif ($cart_total >= $free_limit2) {
echo CART_HEADER_QUALIFIES_MI_CONT . $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
} elseif ($cart_total >= $free_limit) {
echo CART_HEADER_QUALIFIES_MI . $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT . $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
} else {
echo CART_HEADER_DIFF_PRE . $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST . CART_HEADER_DIFF_PRE_CONT . $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT . CART_HEADER_DIFF_PRE_CANADA . $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
}
//} else { //doesn't work for 3 zones
// echo CART_HEADER_FREE_LIMIT_PRE . $currencies->format($free_limit) . CART_HEADER_FREE_LIMIT_POST;
//} //if need to use $cart_count, expand the above like the previous else case substituting $free_limit/2/3 for $diff_to_free/2/3
echo '</div>';
} ?>
-
Re: Shoppingcart/Freeship in Header support
You're a genius!!!
Thank you!! It works perfectly!
-
Re: Shoppingcart/Freeship in Header support
Good to hear that. So the commented-out if() is not needed, I take it?
-
Re: Shoppingcart/Freeship in Header support
Correct. Not needed. It actually breaks the page.
In the spirit of sharing, I made some other changes that work for my case. I wanted so display Free Shipping Over $XXX when shopping cart is 0 instead of the whole message "add $xx for free shipping etc."
So I added a conditional if the cart is 0 which triggers a different message
PHP Code:
<?php
$free_ship_on = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
if ($free_ship_on == 'false') {
echo '<div id="cartFreeShip">';
$free_limit = MODULE_SHIPPING_FREEOPTIONS_MICHIGAN_TOTAL_MIN; //mi
$free_limit2 = MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN; //continental us
$free_limit3 = MODULE_SHIPPING_FREEOPTIONSINT_TOTAL_MIN; //canada
$diff_to_free = ($free_limit - $cart_total);
$diff_to_free2 = ($free_limit2 - $cart_total);
$diff_to_free3 = ($free_limit3 - $cart_total);
//if ($cart_count) { //hopefully this is not needed in order to evaluate $_SESSION['cart']->show_total() which can == 0 for this code
// $_SESSION['cart']->get_products(); //this was leftover from old code and has no current function in any case, so just delete it
$cart_total = $_SESSION['cart']->show_total();
if ($cart_total >= $free_limit3) {
echo CART_HEADER_QUALIFIES_CANADA;
} elseif ($cart_total >= $free_limit2) {
echo CART_HEADER_QUALIFIES_CONT . CART_HEADER_DIFF_PRE . $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
} elseif ($cart_total >= $free_limit) {
echo CART_HEADER_QUALIFIES . CART_HEADER_DIFF_PRE . $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT . $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
} elseif ($cart_total == '0') {
echo CART_HEADER;
} else {
echo CART_HEADER_DIFF_PRE . $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST . CART_HEADER_DIFF_PRE_CONT . $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT . CART_HEADER_DIFF_PRE_CANADA . $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA; }
//} else { //doesn't work for 3 zones
// echo CART_HEADER_FREE_LIMIT_PRE . $currencies->format($free_limit) . CART_HEADER_FREE_LIMIT_POST;
//} //if need to use $cart_count, expand the above like the previous else case substituting $free_limit/2/3 for $diff_to_free/2/3
echo '</div>';
} ?>
The define CART_HEADER can be any shorter message. In my case it just displays "Free Continental Shipping over $85"
-
Re: Shoppingcart/Freeship in Header support
Hello everyone,
Has anyone suggestions on how to exclude certain category id's and product id's from being calculated in the free shipping header?
// bof This is to remove Category from free shipping always
if (!IS_ADMIN_FLAG) {
global $cart;
$chk_cat = 0;
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '9');
$chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '21');
if ($chk_cat > 0) {
$this->enabled = false;
}
}
// eof This is to remove Category from free shipping always
The above code works in freeoptions.php but not in the freeship header.
Thanks
-
Re: Shoppingcart/Freeship in Header support
That code appears to be part of a class file, and will not work as is outside of the class.
$this->enabled = false;
is not applicable or meaningful in the shoppingcart/freeship files. You would have to rework the action based on the test and the new file context.
-
Re: Shoppingcart/Freeship in Header support
I'd like to hide the header cart unless there is something in the cart. Any ideas on the code for that? Thank you in advance. Limey
-
Re: Shoppingcart/Freeship in Header support
That is pretty easy. Find this at the top of tpl_cart_header.php:
PHP Code:
$cart_count = $_SESSION['cart']->count_contents();
?>
<div id="cartHeader">
and change to
PHP Code:
$cart_count = $_SESSION['cart']->count_contents();
if ($cart_count) { //only show if something in cart
?>
<div id="cartHeader">
At the bottom of the file, find this: and change to
PHP Code:
} ?>
</div>
<?php } // /only show
?>
If you want the wrapper div to remain as a placeholder for the layout, move the test inside the div, like this
PHP Code:
$cart_count = $_SESSION['cart']->count_contents();
?>
<div id="cartHeader">
<?php if ($cart_count) { //only show if something in cart
?>
//body of file
}
} // /only show
?>
</div>
-
Re: Shoppingcart/Freeship in Header support
Thanks Glenn - that works a treat. Appreciate appreciate.
Limey
-
Re: Shoppingcart/Freeship in Header support
how can i modify this for a mixed cart? (not calculate items im not willing to ship for free)