Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Splitting shopping cart page

    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

  2. #2
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Splitting shopping cart page

    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.

  3. #3
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Re: Splitting shopping cart page

    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

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Splitting shopping cart page

    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:
    Code:
    #cartInstructionsDisplay,
    #scUpdateQuantity,
    #scRemoveHeading,
    .cartQuantityUpdate,
    .cartRemoveItemDisplay,
    .buttonRow
    {
      display: none;
    }
    2. Add the highlighted code here to your custom tpl_shopping_cart_default.php file:
    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
      }
    ?>
    
    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.
    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.

  5. #5
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Re: Splitting shopping cart page

    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 use
    PHP Code:
    $product['showFixedQuantityAmount'
    but It doesn't work.

    Thanks for all your amazing help!
    Danny

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Splitting shopping cart page

    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.

  7. #7
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Re: Splitting shopping cart page

    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:
    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 a normal customer is logged in (not me):
    Click image for larger version. 

Name:	capture3.PNG 
Views:	92 
Size:	47.7 KB 
ID:	12783

    Heres how the cart looks when customer id 1 is logged in (me):
    Click image for larger version. 

Name:	Capture1.PNG 
Views:	129 
Size:	55.0 KB 
ID:	12784
    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):
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	89 
Size:	49.9 KB 
ID:	12785
    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!

 

 

Similar Threads

  1. Replies: 1
    Last Post: 22 Dec 2014, 08:55 PM
  2. Add to Cart - splitting attribute options
    By home2gifts in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 28 Feb 2013, 02:47 AM
  3. Remove right sidebox shopping cart from when on shopping cart page
    By alterego55 in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 2 Oct 2010, 01:45 AM
  4. Replies: 2
    Last Post: 7 Oct 2009, 05:33 AM
  5. Splitting the shopping cart off the main page...
    By darkdirk1 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 Jun 2007, 08:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg