Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2010
    Posts
    20
    Plugin Contributions
    0

    Default Featured catagory php require(*)

    Hey Guys,

    I am a fresh install of ZC 1.3.9b installed on my local computer being served by XAMPP using PHP 5.3.1, MySQL 5.3 and Apache 2.2.14 (all of which is probably not important ).

    I have a section on my header where I want to create a link that says "Checkout out (blah) category!" where (blah) is the name, and the name, and corresponding link, to the category listed on the top in the category box.

    The code in the category sidebox uses the $box_categories_array variable which holds this information which is created in the includes/modules/sideboxes/categories.php file:


    PHP Code:
    $main_category_tree = new category_tree;
        
    $row 0;
        
    $box_categories_array = array();

    // don't build a tree when no categories
        
    $check_categories $db->Execute("select categories_id from " TABLE_CATEGORIES " where categories_status=1 limit 1");
        if (
    $check_categories->RecordCount() > 0) {
          
    $box_categories_array $main_category_tree->zen_category_tree();
        }
    ... 
    What is the proper convention to require this file in my tpl_header.php file. I am looking for one line of php that looks something like

    PHP Code:
    require(*some magic ZC function calls with constants*); 
    thanks

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

    Default Re: Featured catagory php require(*)

    What you're describing isn't very clear. I'm confused about whether you're trying to draw attention to just one category, or always to the first sub-cat within a category, or whether it's to promote certain products/categories on a revolving basis.

    What you've proposed will just double the amount of hits to the database, resulting in slowed performance.

    I think it would be more effective for you to use a built-in tool like the Banner Manager to draw attention to individual promotions. It's already built-in to the tpl_header, so would be simply a matter of configuring the banner appropriately.
    No PHP or additional database hits required.
    .

    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.

  3. #3
    Join Date
    Apr 2010
    Posts
    20
    Plugin Contributions
    0

    Default Re: Featured catagory php require(*)

    My goal:
    I want to generate a link that points to a category of products. For example if a category is named "Education" the link would say "Check out our Education Category!"

    It would also be cool if the link was dynamically created to point to the category that is displayed first in the category sidebox.

    How I'd like to do it:
    Import the same function that generates the category sidebox; this will probably be accomplished by requiring the /modules/sideboxes/categories.php file.

    The question I am asking:
    What require statement would import the category.php file correctly utilizing the zen-cart framework. Or, if there is an alternate implementation, I'm open to suggestions .


    I understand there will be more database calls if I do it this way, do you have an alternate implementation.

    Thanks for the response DrByte.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Featured catagory php require(*)

    Are your categories going to be constantly changing in their display order? (This would be a very bad idea for customer familiarity.) Or are you going to be frequently making new categories which would display at the top of the list?
    If not, by far the simplest solution would be to make a link in tpl_header.php with your desired text, pointing to <a href="index.php?main_page=index&amp;cPath=23"> where 23 is replaced by the cPath to the desired category.

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

    Default Re: Featured catagory php require(*)

    Quote Originally Posted by ssmith.cp View Post
    My goal:
    I want to generate a link that points to a category of products. For example if a category is named "Education" the link would say "Check out our Education Category!"

    It would also be cool if the link was dynamically created to point to the category that is displayed first in the category sidebox.
    Forgive me for the slight bunny-trail here ...
    I'm having a hard time figuring out why that's somehow important to the visitor? If they've already clicked on "Education", why do you need to pester them to "Check out our Education Category!"? Feels like marketing bullying. It's that kinda stuff that makes me leave your website and go someplace else.
    .

    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.

  6. #6
    Join Date
    Apr 2010
    Posts
    20
    Plugin Contributions
    0

    Default Re: Featured catagory php require(*)

    The "featured" category is the same on every page. We sell educational films and have often get visitors looking at particular categories. For example, in June we are going to a conference on early childhood development and I'd like a link in the header so prospective customers can easily view products in that category.

    We have another conference in September for Gerontology. In that case, we would want to direct customers to that category.

    Is it necessary that I explain why I want to do this?

  7. #7
    Join Date
    Apr 2010
    Posts
    20
    Plugin Contributions
    0

    Default Re: Featured catagory php require(*)

    Quote Originally Posted by gjh42 View Post
    Are your categories going to be constantly changing in their display order? (This would be a very bad idea for customer familiarity.) Or are you going to be frequently making new categories which would display at the top of the list?
    If not, by far the simplest solution would be to make a link in tpl_header.php with your desired text, pointing to <a href="index.php?main_page=index&amp;cPath=23"> where 23 is replaced by the cPath to the desired category.
    I didn't think about customer familiarity. I am using the cPath link right now...

    Thanks for your input gjh42... I think I am going to do it this way

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

    Default Re: Featured catagory php require(*)

    Quote Originally Posted by ssmith.cp View Post
    Is it necessary that I explain why I want to do this?
    Yes, and your own comments explain why:
    Quote Originally Posted by ssmith.cp View Post
    I didn't think about customer familiarity. I am using the cPath link right now...

    Many many many many times people come along here with preconceptions of complicated ways of doing something and waste days of their own time and that of volunteers and support persons on something that would be better done much smarter if the *real* reason behind the whole question was explained in the first place.
    As you've just seen, it's beneficial to understand the reasoning or "business need" behind a "wish". Often the answer is much simpler than first anticipated.
    .

    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.

  9. #9
    Join Date
    Apr 2010
    Posts
    20
    Plugin Contributions
    0

    Default Re: Featured catagory php require(*)

    Thanks Dr. Byte, lesson learned
    Last edited by ssmith.cp; 6 May 2010 at 09:09 PM.

 

 

Similar Threads

  1. Error MessageWarning: require(includes/application_top.php) [function.require]: faile
    By valbuhagiar in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 31 Oct 2011, 07:44 PM
  2. Catagory to featured on index page
    By Rizla in forum General Questions
    Replies: 2
    Last Post: 12 Apr 2011, 06:23 AM
  3. require(DIR_WS_INCLUDES . 'header.php'); problems
    By confused_aswell in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 29 Oct 2008, 12:17 AM
  4. Featured Products in Top Level Catagory
    By cleverpork in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 30 Jan 2008, 07:35 PM

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