If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Need help modifying New Products displayed content on the index page

Need help modifying New Products displayed content on the index page

Started by jeffmic on 20 Jan 2013, 3:44 PM · Views: 743

Results 1 to 6 of 6
20 Jan 2013, 3:44 PM
#1
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Post #1 by jeffmic

Hi everyone,

I'm using a new install of 1.5.1 with a template called Premium 9a.
I've currently enabled New Products to display only on the index page at this time.
It shows the product image, plus the product name below it and the price below that displaying in a 3 column width.

I want to change the content of what is displayed, but I've hit a brick wall.

My website sells karaoke tracks, so the product name is not sufficient enough info alone for the customer. I have attempted to add the product description instead of the price in that location, but there is too much content that I don't need to display, but it didn't work and I couldn't figure out the problem in the logs . My current product description also has <br>'s and other data in it in it, so this appears as raw data on the index page new products result as well with other templates that I've tested.

To prepare for the change I need, I created a new field at the end of the 'products_description' table called 'products_artist' and I've populated it with the song's artist.

I want to edit the includes/modules/new_products.php file so that the price is removed (which I DID figure out how to do that initially) and REPLACE it 'products_price' from the table 'products' with
'products_artist' from the table 'products_description.'

My final result will have the product image, then the product title underneath followed by the product artist underneath that.

Can anyone help me to accomplish this?

thank you so much......

Jeff Michaels,
pres of Musical Creations Ltd.

22 Jan 2013, 3:46 AM
#2
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Post #2 by jeffmic

Does anyone have any advice on this??

Jeff Michaels,
pres of Musical Creations Ltd.

22 Jan 2013, 4:59 AM
#4
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Post #4 by jeffmic

thank you :-)

Here is a link to the template that I used:
http://www.zenflavor.com/premium-9

and here is a link to my test website

http://store4.musicalcreations.com

jeff

Jeff Michaels,
pres of Musical Creations Ltd.

22 Jan 2013, 7:20 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #5 by drbyte

new_products.php

  1. Update the query by adding your custom field:
    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,[B] pd.products_artist,[/B]
                                  p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
  1. And then update the array of data being output:
    In v1.5.1 it looks like this:
    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);
```But that's on a really long line that's hard to read, so let's separate it on its components (breaking intelligently on the . symbol):```
    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . 
              '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . 
              $products_price);
```You can see that it's basically just an image (clickable), plus the product name (also clickable) followed by the price.
And, since all you said you wanted to change there is replace the price with the artist data, it's really as simple as replacing $products_price with **$new_products->fields['products_artist']**

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Jan 2013, 7:20 PM
#6
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Post #6 by jeffmic

Once again buddy - YOU ARE THE BEST!!

thank you,
Jeff

Jeff Michaels,
pres of Musical Creations Ltd.