Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Products Icon


Guest

Recommended Posts

  • Replies 123
  • Created
  • Last Reply

Top Posters In This Topic

why in product listing I've always the new icon?

http://www.100asa.it/index.php?manufacturers_id=12

 

Your compare thing does not work, all the resulta come out blank.

 

I never see the new icon, what do you mean?

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

@pop:

Looks good now, your results page  :thumbsup: . Seems that the Search Highlight Contrib would fit into my Store also, i think i will add it soon!

 

@jared: That was exactly what i needed! Big THX 4 HLP !!!  :lol:

 

Yeah, i love this masterpiece of script. OSC rulez... I am learning something new every day ...

 

 

I like it, but there is one small problem with it. If you do a search that has an "S" at the end, it will yeild no results.

 

Go to http://www.popthetop.com/catalog/index.php and do a search for Binoculars and then do a search for Binocular and you will see.

 

No one seems to have a fix for that. The code seems to want to remove the "S" for what ever reason and that is why and I can not figure out how to fix it.

 

Here is that part of the code if you want to take a looksy...

// Search Highlight enhancement mod start
 if(isset($_GET['keywords']) && $_GET['keywords'] != ''){
 if(!isset($_GET['s'])){
     $pwstr_check = strtolower(substr($_GET['keywords'], strlen($_GET['keywords'])-1, strlen($_GET['keywords'])));
     if($pwstr_check == 's'){
       $pwstr_replace = substr($_GET['keywords'], 0, strlen($_GET['keywords'])-1);
       header('location: ' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT , 'search_in_description=1&s=1&keywords=' . urlencode($pwstr_replace) . '' ));
       exit;
     }
   }

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

HA HA!

 

I just fixed it myself!

I removed the code about striping the "S" and now it works great...

 

// Search Highlight enhancement mod start
 if(isset($_GET['keywords']) && $_GET['keywords'] != ''){
/*
 if(!isset($_GET['s'])){
     $pwstr_check = strtolower(substr($_GET['keywords'], strlen($_GET['keywords'])-1, strlen($_GET['keywords'])));
     if($pwstr_check == 's'){
       $pwstr_replace = substr($_GET['keywords'], 0, strlen($_GET['keywords'])-1);
       header('location: ' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT , 'search_in_description=1&s=1&keywords=' . urlencode($pwstr_replace) . '' ));
       exit;
     }
   }
*/

 

I will now post the fix in that support forum.

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

:-" Hey Guys - I'm not a programmer, just a store owner... so smart enough to be accident prone... but... I just installed this contrib (the Jan 05' Version) and ALL my products have the little 'new' tag. I changed the date to 1296000, and it still shows everything as new. Any idea what would cause this? My store is myhappydance.com.

 

Carol

Edited by happydance
Link to comment
Share on other sites

Ok - - I finally got the new icon in the "new products in January" section done. It really didn't take this long, I just finally got time to do it.

 

All changes are in catalog/includes/modules.

Step 1) change this:

<!-- new_products //-->
<?php

to this:

 <!-- new_products //-->
<?php
// added for New Product Icon contribution
 $today_time = time();
// end addition

That sets the variable to the current time so that we can reference it later for comparison purposes.

 

Step 2) change this:

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct, p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 

to this:

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   $new_products_query = tep_db_query("select p.products_date_added, p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_date_added, p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

We just added the products_date_added to each of those two queries.

 

Step 3) find this:

  while ($new_products = tep_db_fetch_array($new_products_query)) {
   $new_products['products_name'] = tep_get_products_name($new_products['products_id']);

and add the following right below it:

    // added for New Product Icon contribution
   //  2592000 = 30 days in the unix timestamp format
   if ( ($today_time - strtotime($new_products['products_date_added'])) < 5184000) {
    $products_alt=$new_products['products_name'];
    $new_products['products_name'] .= ' <img src="images/icon_newarrival.gif" alt="new product" border="0">';
    }
   // end addition for New Product Icon contribution

 

Step 4) find this:

                                           'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $products_alt, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

 

and change it to this:

                                           'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

 

That should be it!

 

-jared

Link to comment
Share on other sites

FWIW, I really _do_ plan to update the contrib with these fixes/changes, but I'm soooooooo close to being done with a moderate-level site revamp that I need to focus on that.

 

I actually did this little bit for my revamp - - I was tired of it being half-done.

 

Speaking of half-done, I modified icon_newarrival.gif to give it a transparent background. It's attached to this post, but I'll include it in the contrib update as well.

 

-jared

post-19400-1105513601_thumb.gif

Link to comment
Share on other sites

No, that still shows the image tag code in the ALT along with the product name.

 

I just took it out because the products are listed in a box called NEW products for January so people already know that those items are new anyway.

L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Link to comment
Share on other sites

  • 2 weeks later...

I *really* need to release an update with the fixes from this forum.

 

ts201, your problems should be fixed with suggestions earlier on in this thread.

 

-jared

Link to comment
Share on other sites

Are you asking me to go point out for you which posts in this thread fix which problems? I seriously doubt that in the 4 min between my previous post and your post, you've gone and actually looked at the posts. Please do that now.

 

-jared

Link to comment
Share on other sites

Hello people.

 

Top contrib mate.

 

I was wondering if there is any chance of putting the new icon image at the top of the listings in the product listings only.

 

// added for New Product Icon contribution

// 2592000 = 30 days in the unix timestamp format

if ( ($today_time - strtotime($listing['products_date_added'])) < 2592000) {

$listing['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT);

}

// end addition

 

 

My problem is that the new icon is at the end of the product name but some of my products have quite long names so what it is doing is going on to line 2 and doesn't look good.

 

Therefore is there any way of getting the new icon to display with the product name underneath. I have played with the code alittle but i have't got a clue with what i am doing with php.

 

If this could be done then i will bow down before you....

Link to comment
Share on other sites

Sorry I haven't yet been able to release an update with all of the fixes from this thread. I will soon, I promise! (Unless someone beats me to it, HINT HINT. :) )

 

Therefore is there any way of getting the new icon to display with the product name underneath. I have played with the code alittle but i have't got a clue with what i am doing with php.

Rather than complicate the code further, one easy way would be to display the icon prior to displaying the name. How you like that?

 

Here is how to do that: go through the contrib instructions, and wherever you see something like this:

                  $listing['products_name'] .= ' <img src="images/icon_newarrival.gif" alt="new product" border="0">';

, IOW, where the icon is appended to the product name, then change it to be like this:

                   $listing['products_name'] = ' <img src="images/icon_newarrival.gif" alt="new product" border="0">' . $listing['products_name'];

 

Notice that all we're doing is add the icon to the beginning of the name instead of appending it to the product name. Does that work for you? If so, it should be an easy enough change.

 

it doesn't seem to work when in coloumns.

I took a look at the contrib that does the column listing, and it looks like you could use the same logic in includes/modules/product_listing_col.php as the New Products Icon readme says to use in includes/modules/product_listing.php . Have you tried that?

 

-jared

Link to comment
Share on other sites

I downloaded this contrib and did exactly as said in the readme file, right upto each character. Don't know why the icons do not show. I also went thru the entire posting to find a solution but cannot make out why mine is not working.

 

jcall, are you uploading the latest revision soon?

 

Nafisa

Nafisa

Link to comment
Share on other sites

Did you add this:

// added for New Product Icon contribution
$today_time = time();

to the right files?

 

To upload it, I have to put it together first, and that requires 30+ minutes of dedicated time. While it's been easy lately to get 5 min here and 5 min there, I don't want to mess up the contrib by not being able to pay attention to it for enough time to create a quality upload.

 

Anyone else could do it as well - - just download the one that's already out there and make the modifications from this forum.

 

The only other thing I've done is enable it (using the same style code changes) for the "new products this month" box that shows up on the front page.

 

Tell you what: If I can get my kids to sleep early tonight, I'll see if I can upload it tonight. If it's not uploaded tonight, you can be sure that I have rotten kids who often won't go to sleep until 11pm or later (really).

 

-jared

Edited by jcall
Link to comment
Share on other sites

Jared,

 

Thanks for the quick reply. I have an 11 month at home to attend to. I totally understand the timing issue.

 

Yes, I did add $today_time = time(); to catalog/products_new.php

 

As you suggested i would go through the thread and carefully see if i am missing something. This is a great contrib that i thought i could use especially because i am not using the bottom 'New Products this month' infobox on my site.

 

Thanks,

Nafisa

Nafisa

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...