Forums / Templates, Stylesheets, Page Layout / wrap group product listing information

wrap group product listing information

Views: 706

Results 1 to 6 of 6
2 Aug 2015, 9:22 PM
#1
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

wrap group product listing information

Hi,

I have installed column layout grid, and it works fine, I am trying to customize it by adding specific divs, some of which are ok when done in common/tpl_columnar_display.php but I need to group some of the information together which I guess should be done in modules/product_listing.php file and I am lost there.

Right now I have this:

<div class="my-wrapper-one"><!-- this is added in common/tpl_columnar_display.php -->
<!-- these are coded in modules/product_listing.php -->
	<div class="centerBoxContentsProducts centeredContent back">
		<div class="listingImage">
		<img src="images/dvd/a_bugs_life.gif" />
		</div>
		<h3 class="itemTitle">A Bug's Life</h3>
		<div class="listingDescription">
		A Bug's Life
		</div>
		<div class="listingPrice">
		35.99
		</div>
		<div class="listingButtonGroup">
		... more info
		</div>
		<div class="listingModel">
		DVD-ABUG
		</div>
	</div>
<!-- END these are coded in modules/product_listing.php -->
</div>

Now what I need is to group and wrap those info generated in modules/product_listing.php
something like this

<div class="my-wrapper-one"><!-- this is added in tpl_columnar_display.php -->
	<div class="centerBoxContentsProducts centeredContent back">
		<div class="my-first-group">
			<div class="listingImage">
			<img src="images/dvd/a_bugs_life.gif" />
			</div>
			<h3 class="itemTitle">A Bug's Life</h3>
		</div>
		<div class="my-second-group">
			<div class="listingDescription">
			A Bug's Life
			</div>
			<div class="listingPrice">
			35.99
			</div>
			<div class="listingButtonGroup">
			... more info
			</div>
			<div class="listingModel">
			DVD-ABUG
			</div>
		</div>
	</div>
</div>

Eventually being able to move some info from one group to the other would be great.

Thank you

13 Sep 2015, 5:40 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: wrap group product listing information

So haven't looked at the code that generates each of those, but not every product would output each of those subgroups, so will need to establish a "flag" indicating the previous group(s) have:have not been output. At the point of outputting any group after the first need to close the previous if it was opened and output the next. If at the end of outputting any then need to be sure to close out the last. Also assuming that evey such thing output will be within some group or else the process becomes a little more complicated.

Thinking that this tracking could be handled with an array with the key being an integer representing the group number and that the group number would be incoporated into the group's class name. Also, because the sequence of display is based on the arrangement of the data to be displayed, that each item be considered "carefully" as to which group number is to be assigned in order to accomplish the above check. If an item can be "regrouped" into it's main group such that say group 2 could appear multiple times in the page and accomplish the desired goal, then may want a second array or variable tracking what group is currently open so that if the item is not in the desired group the previous group is either closed and then the currently desired group is open or the previous group remains open, the new group opened and closed (or delayed in closng pending the next item) and depending on all that may need to track a sort of "depth" of opening and closing so that in the end everything is closed, the number of times opening a group is minimized for two subsequent items of the same group, etc...

So, guess question kind of is what items should be in what groups, what is the method by which you expect to assign items to a group, what kind of "frequency" is this grouping to be modified? What is being done with the grouping to possibly address some of the complexity added in the last paragraph?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Sep 2015, 12:28 PM
#4
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: wrap group product listing information

Thank you.

I lost you at the second line ... ;(

Not being a coder it seems beyond my reach.
I thought it was a matter of adding the extra divs in the modules/product_listing.php file somewhere like here:

    $product_contents = array(); // Used For Column Layout (Grid Layout) Add on module
    $flex_skips = 0; //reset flag for reducing # of columns
	$prev_cell_text = '';
    for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
      $lc_align = '';
      $lc_text = '';
      switch ($column_list[$col]) {
        case 'PRODUCT_LIST_MODEL':
        $lc_text = '<div class="listingModel">' . $listing->fields['products_model'] . '</div>';
		$lc_class = 'listingModelCell';
        break;
        case 'PRODUCT_LIST_NAME':
        $lc_text .= '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
		$lc_class = 'listingNameCell';
        break;
        case 'PRODUCT_LIST_MANUFACTURER':
        $lc_text .= '<div class="listingManufacturer"><a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '">' . $listing->fields['manufacturers_name'] . '</a>' . '</div>';
		$lc_class = 'listingManufacturerCell';
        break;
        case 'PRODUCT_LIST_PRICE':
        $lc_price = zen_get_products_display_price($listing->fields['products_id']);
        $lc_text .= '<div class="listingPrice">' . $lc_price . '</div>';
		$lc_class = 'listingPriceCell';

Of course the above is just a snip, and might not be the right one, I just saw that there are some of the infos, and relative divs there.

I guess I'll have to change my mind about this it.

14 Sep 2015, 12:49 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: wrap group product listing information

If not mistaken that is the area I wrote about yesterday while waiting for the restaurant to prep my food to go. (Meaning, wasn't in a position to give direct code changes.) But it appears that yes that would be the area to apply the above logic so that desired results can be obtained.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Sep 2015, 3:24 PM
#6
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: wrap group product listing information

Thanks.

My problem is indeed applying the logic.
Maybe someone in the future will, for now I'll keep using it as is.