Hi There,
I want the to make another shopping cart template e.g (tpl_shopping_cart_default2.php) that will load ifthe customer id is "2"
Where is the shopping cart template loaded from?
Danny
Hi There,
I want the to make another shopping cart template e.g (tpl_shopping_cart_default2.php) that will load ifthe customer id is "2"
Where is the shopping cart template loaded from?
Danny
The customer ID is NOT available until the customer is logged in.
So the normal shopping cart won't have that available,
unless you have set, that the customer must be "logged in to shop".
A bit more background info is required here.
Exactly what business problem are you trying to solve with this.
Okay so here it goes,
I want my store to handle quoting customers and I want to be able to simply copy and paste the shopping cart page to customers in an email. This work already but it still has all the links such as update and delete which I don't want.
My idea was to create a separate shopping cart template and have it load up for customer id "1" which is me. Which will remove a lot of the shopping cart details to make it a lot better for copying into emails.
Thanks!
Danny
While there are other more complex and more thorough ways to do it if you truly needed a different additional template for that page, the following simpler approach will probably give you the best of both worlds.
See, one thing you didn't state in your post was how you would later remove things from your cart when you were done preparing a quote ... and if you've removed the update/delete buttons then you won't have that option!
So, the following approach simply adds an extra section onto the page -- from which you can copy/paste using your clipboard but not affect the rest of the normal operation of the shopping cart page.
Two steps:
1. Add all of the following to the bottom of your print_stylesheet.css file:2. Add the highlighted code here to your custom tpl_shopping_cart_default.php file:Code:#cartInstructionsDisplay, #scUpdateQuantity, #scRemoveHeading, .cartQuantityUpdate, .cartRemoveItemDisplay, .buttonRow { display: none; }Now you can click the QuoteFormat link near the top of the page and it'll toggle the print stylesheet on/off. You can then copy+paste as desired. Or print of course.Code:<?php if ($_SESSION['cart']->count_contents() > 0) { ?> <div class="forward"><?php echo TEXT_VISITORS_CART; ?></div> <?php } ?> <?php if ($_SESSION['customer_id'] && $_SESSION['customer_id'] == 1) { ?> <script> function togglePrintStylesheet() { for(var i=0; i<document.styleSheets.length; i++) { var sheet = document.styleSheets[i]; if (sheet.media.length == 1) { sheet.id = 'printStylesheet'; sheet.media.mediaText = 'print, screen'; } else if (sheet.media.length == 2 && sheet.id == 'printStylesheet') { sheet.media.mediaText = 'print'; sheet.media.length=1; } } } </script> <a href="#" onclick="togglePrintStylesheet();return false;">QuoteFormat</a> <?php } ?>
Change the customer number as needed. You said 2 in one post, and 1 in another. I used 1 in my example here.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Ooooooooooooooooooooooooooooooo this is perfect!
I use customer id 1, the contents of the basket get removed on login. Just one more question..
In the shopping cart, the quantity is an input text box, I don't want it as a input box but only to just display the quantity when its customer id 1.
I thought I would be able to usebut It doesn't work.PHP Code:$product['showFixedQuantityAmount']
Thanks for all your amazing help!
Danny
That's a lot more complicated
Is it really necessary? It should copy+paste pretty well as-is.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I managed to do it, I don't have a clue how or why it works. BUT IT WORKS!
Heres the code for showing the quantity:
Heres how the cart looks when a normal customer is logged in (not me):PHP Code:<?php
if($_SESSION['customer_id']==1)
{ echo ' x ' . $product['showFixedQuantityAmount'];
echo '<div class="cartQuantityUpdate">' . $product['quantityField'] . '</div>';}
else {
if ($product['flagShowFixedQuantity']) {
echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
} else {
echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
}}
?>
Heres how the cart looks when customer id 1 is logged in (me):
The "Add extra unit" takes me to a page where I can add practically anything to the cart using a slightly modified price per letter thing. This allows me to add products that are one offs or that are not in the cart
And heres how to cart looks when I click quote format (me):
This is a simple form that can be copied into email and the button "complete order online" generates a link that when clicked adds the entire shopping cart to the website as a guest and taking them to the cart page allowing them to just purchase the quote straight away.
This button uses a little thing that was made here:
http://www.zen-cart.com/showthread.php?201097
I hope this post may help people in the future if anyone alse happens to do this. Please note that I am not any good at php or even zencart so this may not work for you. It may not be the best way to do things. It may not be what your looking for. I wont be able to help much if you ask me either!
Thanks DrByte for the help!