Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2010
    Location
    Nottingham UK
    Posts
    87
    Plugin Contributions
    1

    Default Changing the order of product listing elements (product_listing.php)

    Hi all,

    I've setup a new vanilla install of the v1.55a onto my linux vps. I'm tweaking the responsive_classic template to fit my new layout and I've got stuck on what I thought might be an easy to fix element (after a couple of hours of time wasted, I'm not so sure if now!)

    On the products listing page (the one with a category description at the top, with all products in that category listed below), I want to move the model number text to the right and below the product title. Specifically the div with the class 'list-model'.

    I've had a search through the template files and can see the page is generated by the product_listing.php and tpl_tabular_display.php. I believe the problem is that the model text is stored into the $list_box_contents array first, so is always spat out first. I want to change this to come in 3rd (after the title but before the description).

    so from this:

    Click image for larger version. 

Name:	a.jpg 
Views:	53 
Size:	20.9 KB 
ID:	16440

    Click image for larger version. 

Name:	a2.jpg 
Views:	53 
Size:	185.5 KB 
ID:	16441

    to this:

    Click image for larger version. 

Name:	b.jpg 
Views:	48 
Size:	20.9 KB 
ID:	16442

    Click image for larger version. 

Name:	b2.jpg 
Views:	55 
Size:	45.8 KB 
ID:	16443

    Notice the text for CPM201.

    Any ideas if this is possible?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Changing the order of product listing elements (product_listing.php)

    It's Zen Cart, which is open source... anything is possible.

    Modify the order of items in the variable: $define_list found in includes/modules/pages/index/main_template_vars.php

    The order of these variables is the order for display of the information.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Mar 2010
    Location
    Nottingham UK
    Posts
    87
    Plugin Contributions
    1

    Default Re: Changing the order of product listing elements (product_listing.php)

    Hi mc12345678,

    Thanks for the reply.

    I've found the section I believe you were referring to in the main_template_vars.php:

    PHP Code:
      // create column list
      
    $define_list = array(
      
    'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
      
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
      
    'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL// I've moved this to here to display the model number on the right above the title
      
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
      
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
      
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
      
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
      
    /*                         ,
      'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
      */

      
    asort($define_list);
      
    reset($define_list); 
    However, no matter the order I seem to put the items in this list, I can only get the model to land in one of two positions on the listing page. It'll either be where previously described (on the left above the product image) or it'll display on the right above the product title.

    Click image for larger version. 

Name:	a1.jpg 
Views:	73 
Size:	22.1 KB 
ID:	16447

    Are there any further points I'm missing?

    Thanks again for your help this far.
    Last edited by bottyz; 16 Jun 2016 at 04:14 PM. Reason: wrong image

  4. #4
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Changing the order of product listing elements (product_listing.php)

    Quote Originally Posted by bottyz View Post
    Hi mc12345678,

    Thanks for the reply.

    I've found the section I believe you were referring to in the main_template_vars.php:

    PHP Code:
      // create column list
      
    $define_list = array(
      
    'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
      
    'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
      
    'PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL// I've moved this to here to display the model number on the right above the title
      
    'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
      
    'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
      
    'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
      
    'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);
      
    /*                         ,
      'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
      */

      
    asort($define_list);
      
    reset($define_list); 
    However, no matter the order I seem to put the items in this list, I can only get the model to land in one of two positions on the listing page. It'll either be where previously described (on the left above the product image) or it'll display on the right above the product title.

    Click image for larger version. 

Name:	a1.jpg 
Views:	73 
Size:	22.1 KB 
ID:	16447

    Are there any further points I'm missing?

    Thanks again for your help this far.
    Seeing as changing the sequence did have effect on the display, the next thing of consideration would likely be the CSS that applies to it. Can't help from an image, those helping with CSS related matters would need to be able to access the page in question to then press F12 on the browser and begin locally modifying information related to the objects presented.

    (Yeah wondered why when I clicked on the provided image that it didn't work. :) )
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Changing the order of product listing elements (product_listing.php)

    Quote Originally Posted by mc12345678 View Post
    Seeing as changing the sequence did have effect on the display, the next thing of consideration would likely be the CSS that applies to it. Can't help from an image, those helping with CSS related matters would need to be able to access the page in question to then press F12 on the browser and begin locally modifying information related to the objects presented.

    (Yeah wondered why when I clicked on the provided image that it didn't work. :) )
    Further as well, you may have been able to keep the sort order as originally provided (would have to think about the next upgrade) and just used css to begin with, depending on how flexible things are/were...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,974
    Plugin Contributions
    96

    Default Re: Changing the order of product listing elements (product_listing.php)

    Just a note that you can control the sort-order of those items within your admin; just navigate to your admin's Configuration->Product Listing and make those sort-order changes there.

 

 

Similar Threads

  1. Change the order of the elements in Product Listing
    By sevaro in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 May 2010, 05:46 AM
  2. need the right path in product_listing.php
    By pascal020 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 5 Nov 2009, 04:44 PM
  3. Product listing - swaping elements around
    By peanut77 in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 31 Jul 2009, 09:22 PM
  4. Changing the vertical order of my header elements
    By BigSash in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 19 Dec 2008, 08:13 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