Page 1 of 5 123 ... LastLast
Results 1 to 10 of 41
  1. #1
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Showing a specific category if the shopping cart is empty.

    I have a customer that wants to display a specific category when a customer goes to an empty shopping cart.

    I've identified the file "tpl_shopping_cart_default.php" as the logical place to add the code to do this, but I'm having a bit of a hard time figuring out what include/require (or whatever) I need to use to make this function.

    The existing code to have it display new products, featured products and specials looks quite simple

    Code:
    <?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
    but I need it to display the same as I'd get when loading
    mystore/index.php?main_page=index&cPath=258_260

    Does any have any ideas or suggestions? (is this even possible?)

    Thanks in advance
    RodG

  2. #2
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,542
    Plugin Contributions
    19

    Default Re: Showing a specific category if the shopping cart is empty.

    Hm... I understand it's not exactly what you're asking for, but would you settle for a simple alternative until you get this figured out?

    EDIT: Basically, a centerbox just like what's new, featured etc... Hope it helps...
    Attached Files Attached Files

  3. #3
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Showing a specific category if the shopping cart is empty.

    Quote Originally Posted by RodG View Post
    I have a customer that wants to display a specific category when a customer goes to an empty shopping cart.

    I've identified the file "tpl_shopping_cart_default.php" as the logical place to add the code to do this, but I'm having a bit of a hard time figuring out what include/require (or whatever) I need to use to make this function.

    The existing code to have it display new products, featured products and specials looks quite simple

    Code:
    <?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
    but I need it to display the same as I'd get when loading
    mystore/index.php?main_page=index&cPath=258_260

    Does any have any ideas or suggestions? (is this even possible?)

    Thanks in advance
    RodG
    When you say "go to a specific" category, you do mean that there should be a redirect/load of the categories page that is desired, not just to keep the current page, but add the content of the category's page into some sort of tab, correct?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Showing a specific category if the shopping cart is empty.

    Quote Originally Posted by balihr View Post
    Hm... I understand it's not exactly what you're asking for, but would you settle for a simple alternative until you get this figured out?

    EDIT: Basically, a centerbox just like what's new, featured etc... Hope it helps...
    Thanks for this. I think I might find it useful for another site I've been working on, but it doesn't suit this customers needs.

    Cheers
    RodG

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Showing a specific category if the shopping cart is empty.

    Quote Originally Posted by mc12345678 View Post
    When you say "go to a specific" category, you do mean that there should be a redirect/load of the categories page that is desired, not just to keep the current page, but add the content of the category's page into some sort of tab, correct?
    Either solution would be acceptable.

    Cheers
    RodG

  6. #6
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Showing a specific category if the shopping cart is empty.

    Quote Originally Posted by RodG View Post
    Either solution would be acceptable.

    Cheers
    RodG

    I would add a switch in to the configuration panel to fill in the number. Then do a test where the redirect is It's of redirect is empty then normal page is shown.If it is not empty then check or use the number and redirect with the below.

    zen_redirect(zen_href_link( FILENAME_DEFAULT, zen_get_path(cat#)));
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Showing a specific category if the shopping cart is empty.

    Forgot to mention that if need to also through a redirect code (wasn't sure which would be appropriate), then before the last closing parenthesis, add , "redirect code'

    Where redirect code would be substituted with the applicable # such as 302, 400, etc. (Pick one number though. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  8. #8
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Showing a specific category if the shopping cart is empty.

    Quote Originally Posted by mc12345678 View Post
    I would add a switch in to the configuration panel to fill in the number. Then do a test where the redirect is It's of redirect is empty then normal page is shown.If it is not empty then check or use the number and redirect with the below.

    zen_redirect(zen_href_link( FILENAME_DEFAULT, zen_get_path(cat#)));
    That's good in theory, but in practice it doesn't work due to the headers already being sent

    -------------------------------------------------------------------------------------------------
    Cannot modify header information - headers already sent by (output started at /home/www/mysite/includes/templates/mytemplate/common/html_header.php:41)
    -------------------------------------------------------------------------------------------------

    Cheers
    RodG

  9. #9
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Showing a specific category if the shopping cart is empty.

    Okay, so the next thought would be wherever the link to the shopping cart is generated, to use a test of the quantity of items in the cart, if zero, then the link should be as identified in the redirect (everything in that line except the zen_redirect() portion. If there are items, then goto the cart. That's the "dirty" approach I would take at that point.

    Though I would think that there was a better approach knowing that the headers had already been pushed. :/
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Showing a specific category if the shopping cart is empty.

    But, the approach I just described doesn't handle the condition of everything being deleted from the cart when viewing the cart. Wouldn't putting the previous code in the shopping_cart header_php.php file make it possible to do the redirect without error? (Sorry I'm somewhat guessing now.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 5 123 ... LastLast

Similar Threads

  1. Replies: 5
    Last Post: 21 Apr 2013, 11:37 PM
  2. forgetting shopping cart contacts 'your shopping cart is empty'
    By vandiermen in forum Installing on a Linux/Unix Server
    Replies: 15
    Last Post: 28 Apr 2009, 11:13 AM
  3. Issues with laying out the "shopping cart is empty" page
    By JHouse in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 27 Feb 2009, 08:51 PM
  4. Showing VAT in the shopping cart
    By andyheer in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 0
    Last Post: 26 Jul 2007, 03:27 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR