Zen Cart Logo
Forums / All Other Contributions/Addons / Shoppingcart/Freeship in Header support

Shoppingcart/Freeship in Header support

Views: 19,391

Results 121 to 140 of 181
29 Feb 2012, 02:57
#121
smoothjunk avatar

smoothjunk

New Zenner

Join Date:
Feb 2012
Posts:
3
Plugin Contributions:
0

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!

29 Feb 2012, 05:51
#122
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

29 Feb 2012, 15:07
#123
smoothjunk avatar

smoothjunk

New Zenner

Join Date:
Feb 2012
Posts:
3
Plugin Contributions:
0

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.

21 May 2012, 17:28
#124
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

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.

22 May 2012, 23:11
#125
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

23 May 2012, 15:55
#126
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

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!

25 May 2012, 16:17
#127
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: Shoppingcart/Freeship in Header support

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.

30 May 2012, 02:26
#128
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shoppingcart/Freeship in Header support

Glad you got it sorted!

04 Nov 2012, 04:27
#129
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,675
Plugin Contributions:
0

Re: Shoppingcart/Freeship in Header support

Will this mod work 1.5v?

08 Nov 2012, 17:56
#130
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

16 Nov 2012, 11:23
#131
peteratdd avatar

peteratdd

New Zenner

Join Date:
May 2009
Posts:
8
Plugin Contributions:
0

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?

16 Nov 2012, 23:18
#132
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

20 Dec 2012, 02:23
#133
jackolive avatar

jackolive

New Zenner

Join Date:
Apr 2012
Location:
California
Posts:
21
Plugin Contributions:
0

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.

20 Dec 2012, 06:36
#134
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

20 Dec 2012, 22:21
#135
jackolive avatar

jackolive

New Zenner

Join Date:
Apr 2012
Location:
California
Posts:
21
Plugin Contributions:
0

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 https://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>
21 Dec 2012, 02:18
#136
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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
$products = $_SESSION['cart']->get_products();


Later in that file we have```php
  $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.
21 Dec 2012, 02:21
#137
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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.

21 Dec 2012, 03:58
#138
jackolive avatar

jackolive

New Zenner

Join Date:
Apr 2012
Location:
California
Posts:
21
Plugin Contributions:
0

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>
21 Dec 2012, 04:44
#139
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

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:

$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.
21 Dec 2012, 08:13
#140
jackolive avatar

jackolive

New Zenner

Join Date:
Apr 2012
Location:
California
Posts:
21
Plugin Contributions:
0

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>;

}
?>