Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Customizing the Look of Your Shop / Templates, Stylesheets, Page Layout / Featured Products(on index): Need to change product image & title order

Featured Products(on index): Need to change product image & title order

Locked

Started by pathan on 28 Dec 2009, 1:44 PM · Views: 2,379

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
28 Dec 2009, 1:44 PM
#1
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #1 by pathan

Hi,
as the title describe, I need to shift the title of the product over the image in FEATURED PRODUCTS area in index page. In default zen setup products are listed like:
IMAGE
TITLE
PRICE

I want to change it to:
TITLE
IMAGE
PRICE

Any help will be appreciated.

29 Dec 2009, 11:59 AM
#2
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #2 by pathan

any body?

29 Dec 2009, 2:47 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #3 by ajeh

Using your templates and overrides, customize the module for the featured_products.php and change the order of the content in this section of code:

    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a><br />' . $products_price);

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Dec 2009, 5:03 PM
#4
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #4 by pathan

Thanks Ajeh for your response.
I am editing the correct file and piece of code your mentioned. But when I try to move the image code and save it the index shows nothing. Can you tell me precise code fromat.

29 Dec 2009, 5:51 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #5 by ajeh

Try changing it to:

    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a><br />' . ( ($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . $products_price);

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Dec 2009, 5:53 PM
#6
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #6 by pathan

Thank you so so much. I was stuck in this code for last 2 days. Thanks a lot for your help.

29 Dec 2009, 6:04 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #7 by ajeh

You are most welcome, thanks for the update that this worked for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Dec 2009, 6:17 PM
#8
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #8 by pathan

One more question plz............... how can i add 'In Stock' to this piece of code? When the product is out of stock than it may show "Sold out".

29 Dec 2009, 6:43 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #9 by ajeh

This will give you the image:

zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT); 

you need to add to the SELECT the products_quantity and add a test for <= 0 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

30 Dec 2009, 4:07 AM
#10
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #10 by pathan

Please if you can explain where to put it...I havnt thorough knowledge of php & sql.

31 Dec 2009, 12:14 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #11 by ajeh

There are 2 SELECT statements ...

On the first line of each change:

  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id

to include the quantity:

  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id[B], p.products_quantity[/B]

Add this IF statement above the $list_box_contents that was originally edited:

if ($featured_products->fields['products_quantity'] <= 0) {
  $show_sold_out = '<br />' . zen_image_button(BUTTON_IMAGE_SOLD_OUT_SMALL, BUTTON_SOLD_OUT_SMALL_ALT);
} else {
  $show_sold_out = '';
}

Now you can add the $show_sold_out to the $list_box_contents where you want it to appear, such as after the price:

    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a><br />' . ( ($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . $products_price . $show_sold_out);

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Jan 2010, 7:56 AM
#12
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

Post #12 by pathan

Thanks again Ajeh.
Should I put 'In Stock' image in else statement?

12 Jan 2010, 3:41 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #13 by ajeh

That is what an IF is for ...

IF the condition is met, the first part is done, IF it does not match then the second part, the ELSE, is done ...

So if you are wanting either the SOLD out or the IN STOCK to show, you have the SOLD OUT in the first part and the INSTOCK in the ELSE or second part ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!