Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Changing the order of product listing elements (product_listing.php)

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

Views: 790

Results 1 to 6 of 6
16 Jun 2016, 9:26 AM
#1
bottyz avatar

bottyz

New Zenner

Join Date:
Mar 2010
Location:
Nottingham UK
Posts:
90
Plugin Contributions:
0

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:

Attachment 16440

Attachment 16441

to this:

Attachment 16442

Attachment 16443

Notice the text for CPM201.

Any ideas if this is possible?

16 Jun 2016, 1:54 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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.

16 Jun 2016, 3:09 PM
#3
bottyz avatar

bottyz

New Zenner

Join Date:
Mar 2010
Location:
Nottingham UK
Posts:
90
Plugin Contributions:
0

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:

  // 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.

Attachment 16447

Are there any further points I'm missing?

Thanks again for your help this far.

16 Jun 2016, 4:03 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

bottyz:

Hi mc12345678,

Thanks for the reply.

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

// 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. 
> 
> Attachment 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. :) )
16 Jun 2016, 4:18 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

mc12345678:

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...

17 Jun 2016, 4:19 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

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.