Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2007
    Posts
    176
    Plugin Contributions
    0

    Default change the category page

    hi,

    I want to change around the category page i have on my main page on startup.

    I have 3 initial level categories eg default hardware,software,dvd

    How can i change the display around because i have the files it calls in myoverride. It isn't simple and it calls itself tpl_index_categories without using POST but zen_link (which i don't get).

    I want a table display with another section in 1 column and I know php well enough to get the data from mysql but ZC logic is hard to follow..
    Where can i get more information on changing the display on main page?

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: change the category page

    If you look at line 73 of tpl_index_categories.php you'll see that it calls tpl_modules_category_row.php to display the categories content. This in turn calls a common routine tp_columnar_display.php.

    As a first step, I would recommend that you create a tpl_modules_category_table.php file that in turn calls tpl_tabular_display.php, and then edit line 73 of your tpl_index_categories.php over-ride to call your new tpl_modules_category_table.php.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Feb 2007
    Posts
    176
    Plugin Contributions
    0

    Default Re: change the category page

    Hi,

    I have already done something similar. My problem was not the file management of such a problem but creating my own code to display the data rather than edit the ZC stuff (in those required files). BY creating my own code required me to call again my display categories file with paramters (I use POST) but ZC uses a whole diferent system with zen_link.

    Is this too ambitious with ZC ? would I miss out on setting other variables eg session or hiden stuff? do I need to use zen_link for links? If I create display files in the right areas as suggested with my code calling mysql and links using <a ref would this crash the system?

  4. #4
    Join Date
    Feb 2007
    Posts
    176
    Plugin Contributions
    0

    Default Re: change the category page

    Ok I can change it from where you said and it seems to work.
    This sts the layout as you want exactly and is easy to change the look.

    <?php

    $mpid=$_GET['cPath'];
    if (!isset($mpid))
    $mpid='0';
    //calls tpl modules cat row ->category row ->tplcolumnar display

    $sql2="select categories_name,categories_description.categories_id,categories_image
    from categories_description,categories where parent_id=$mpid and
    categories.categories_id= categories_description.categories_id";
    $result2 = mysql_query("$sql2") or die("Invalid query: " . mysql_error());
    $myrow=0;

    echo "<h1 id='catheading'>".$breadcrumb->last()."</h1>";
    echo "<br><br>&nbsp;&nbsp;".$current_categories_description."<br><br>";
    echo "<table border='0' cellspacing='0' cellpadding='10' id='cattable'>";
    echo "<tr>";

    while($nt=mysql_fetch_array($result2))
    {
    //echo "<br><br>";
    $name= $nt['categories_name'];
    $cid= $nt['categories_id'];
    $cimg= $nt['categories_image'];
    // $mypath="http://localhost/ecommerce/zen/index.php?main_page=product_info&cPath=1_4&products_id=2";
    $mypath="index.php?main_page=index&cPath=".$cid;
    $imgpath='images/'. $cimg;

    echo "<td width='80px' align='right'>";
    echo "<a href='".$mypath."'> ".$name."</a>";
    echo "</td>";
    echo "<td width='100px' align='left'>";
    echo "<img src='".$imgpath."' />";
    echo "</td><td width='40px'></td> ";
    $myrow++;
    if ($myrow==2) {
    echo "</tr>";
    $myrow=0;
    }
    }
    echo "</table>";

    $sql2="select parent_id from categories where categories_id=$mpid ";
    // $sql2="select parent_id from categories where categories_id='4'";

    $result2 = mysql_query("$sql2") or die("Invalid query: " . mysql_error());

    //$name2= $nt['categories_name'];
    $cid2= mysql_result($result2, 0, "parent_id");
    //echo $mpid."...".$cid2;
    //$num_rows=mysql_num_rows($result);
    if ($cid2=='0')
    {
    $mypath="index.php";
    }
    else
    $mypath="index.php?main_page=index&cPath=".$cid2;


    echo "<br><a href='".$mypath."' id='catback'>&nbsp;&nbsp; Back</a>";
    echo "<br>&nbsp;&nbsp;";


    ?>

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: change the category page

    All credit to you mex for getting something working. I wouldn't personally do it this way, but appreciate the frustrations at trying to get something working using complex and largely undocumented Zen Cart structures and facilities.

    To help with your future developments and for others who may be looking at this thread, I would have:
    1. preserved Zen Cart's layered model by putting the database extracts in the relevant modules/pages/ directory
    2. maintained database abstraction by using Zen Cart's database access class
    3. used the zen_href_link function (which once understood is both straightforward and powerful as it takes care of a lot of the template and SSL stuff for you)
    4. preserved XHTML transitional compliance by using compliant markup
    5. not hard-coded in the inline CSS but put it instead into the stylesheet
    6. not used a table (personal preference)

    But credit to you again for getting this far.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  6. #6
    Join Date
    Feb 2007
    Posts
    176
    Plugin Contributions
    0

    Default Re: change the category page

    It was a rush job, and kind of not really zen cart friendly .
    Once i get more experience I can then do things are more zen cart way.

    Also I think eventually I should put up instructions about integrating an exisiting website or wanting a different look than default layout.
    This will take care of the 'why use a ZC shopping cart when they all look the same'.

    Not true , as i have found the relelvant files to add your own code to make it look as you want. I can change home page, sidebox,header ,footersub-categories, product list, product info pages, and add your own. I kind of leave the shopping cart area as I don't need to tamper with it.

    I think it was you who said try it and see, and I was thinking maybe don't tamper with a default layout other than admin small changes.

    I will need a good test of the cart when finished , as it appears to work atm.

 

 

Similar Threads

  1. Change the way products are displayed on a category page
    By jmsnyder23 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 28 Apr 2014, 06:31 PM
  2. How can I change the sub-category page title?
    By lmg2009 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Oct 2011, 03:43 PM
  3. How to change the Main Page Category Icon
    By darkswan in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 May 2009, 07:15 AM
  4. Where to change the Category page header
    By Live Wien in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 May 2008, 10:14 AM
  5. Category pics on front page - how to change the size
    By bjraines in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 10 May 2007, 04:44 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