Post by danitaz » Mon Apr 26, 2010 10:12 am

I've just imported about 100 products from my old shopping cart. And of course that means I have a bunch of products in "Latest products" on the home page that I really don't want there! I can't figure out what controls the "latest products" list. I thought maybe it was lasted edited, or added date, etc., but it doesn't seem like any changes I make to these fields make much difference.

Any ideas how to control this page?

Thanks.

Danita

New member

Posts

Joined
Wed Apr 21, 2010 9:02 am

Post by Qphoria » Mon Apr 26, 2010 10:28 am

It will also show products there based on the date entered. Even if you entered them 10 years ago, the latest ones will show. That is why its called "Latest" products... not "New" products

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by danitaz » Mon Apr 26, 2010 10:53 am

Hmmm - changing the dates around in the database doesn't seem to do anything though - so I guess I just have to live with what is there for now. I'll revisit this later - still have a lot of setup to do that is more important than this!

Thanks.

Danita

New member

Posts

Joined
Wed Apr 21, 2010 9:02 am

Post by Qphoria » Mon Apr 26, 2010 1:22 pm

Well if you want to change them around, you can hack the dates but also need to clear the system/cache file for latest

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by kedgetech » Mon Apr 26, 2010 5:12 pm

Mate this might help!

We had similar implementation to display the products we wanted all the time Irrespective of any latest products added. Small hack but worked for us.

Details

Step 1
(Locate the following file)
<Installation>/catalog/model/catalog/product.php

Step 2
(Locate the following function)
public function getLatestProducts ...

Step 3
(Change the SQL Listed as below, Note - The products numbers are for the products you want to see )

$query = $this->db->query("SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ss.language_id = '" . (int)$this->config->get('config_language_id') ."' AND p.product_id in ('71','29','30','31','33','35','102','42','43','44','45','127') ORDER BY p.date_added DESC LIMIT " . (int)$limit);

Step 4
Delete the cache in <installation> System/Cache folder.
Refresh the screen. You should see your products listed.

Let me know how you go

venkat@morrisnphilip

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by danitaz » Mon Apr 26, 2010 10:38 pm

Thanks kedgetech - that worked perfectly. I assume that somewhere down the line, after I have added a few more "new" products, I'll be able to just remove this part and it will sort itself out again to actually put in the "latest" products. Problem for me of course was that since they were all imported at the same time, years old products were showing as "latest"!

I will point out that everyone in this forum is very helpful! I feel like I've just about got the cart working the way I want now!

Thanks.

Danita

New member

Posts

Joined
Wed Apr 21, 2010 9:02 am

Post by maema » Tue Apr 27, 2010 12:53 am

doesnt work for me... its for which version of open cart ?

New member

Posts

Joined
Fri Nov 27, 2009 3:38 am

Post by kedgetech » Tue Apr 27, 2010 7:36 am

danitaz - Glad it worked for you. If you remove the extra code it will work a normal. Its a small hack as per my customer requirement they dont want to see the latest products.

maema - I am using OC 1.4.4. Mate can you be a little more eloborate than "doesnt work for me..."?

venkat@morrisnphilip

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by maema » Tue Apr 27, 2010 8:28 pm

hello

I'm using opencart 1.3.4
and this hack doesn't work...
Do you have a nice solution like this for 1.3.4 ?

New member

Posts

Joined
Fri Nov 27, 2009 3:38 am

Post by kedgetech » Wed Apr 28, 2010 5:55 am

Mate I did not use 1.3.4 version before. I will see if i could get the older version and help you but never the less I would suggest you should upgrade to latest version at least 1.4.4 + as support wise its not easy for any one to help troubleshoot unless you have a support contact with OC :)

venkat@morrisnphilip

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by kedgetech » Wed Apr 28, 2010 6:30 am

Here you go mate 1.3.4 version . Let me know how you go.

* Note this is Untested fit for OC1.3.4 *

$query = $this->db->query("SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->language->getId() . "' AND ss.language_id = '" . (int)$this->language->getId() ."' AND p.product_id in ('71','29','30','31','33','35','102','42','43','44','45','127') ORDER BY p.date_added DESC LIMIT " . (int)$limit);


venkat@morrisnphilip

User avatar
Active Member

Posts

Joined
Mon Mar 22, 2010 5:20 pm
Location - USA, Australia, India

Post by maema » Wed Apr 28, 2010 9:13 pm

OPEN CART 1.3.4
There is the Hack Using LOCATION field under PRODUCT > DATA to sort :

Step 1
(Locate the following file)
<Installation>/catalog/model/catalog/product.php

Step 2
(Locate the following function)
public function getLatestProducts ...

Step 3
modify :
SRC
..... ORDER BY p.date_added DESC LIMIT " . (int)$limit);
MOD
..... ORDER BY p.location ASC LIMIT " . (int)$limit);

Work using location ;-)
Just notice is not sorted by 1, 2 ,3...10 but more like 01,02,03...10.. it' s sort in alphanumeric... so can use A ,b, c, 3...

can specialist can tell me if it is ok ?
Last edited by maema on Sat May 01, 2010 6:36 pm, edited 5 times in total.

New member

Posts

Joined
Fri Nov 27, 2009 3:38 am

Post by Qphoria » Wed Apr 28, 2010 9:26 pm

ya thats fine

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by neuvo » Fri Apr 30, 2010 4:04 pm

kedgetech wrote:Here you go mate 1.3.4 version . Let me know how you go.

* Note this is Untested fit for OC1.3.4 *

$query = $this->db->query("SELECT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.status = '1' AND p.date_available <= NOW() AND pd.language_id = '" . (int)$this->language->getId() . "' AND ss.language_id = '" . (int)$this->language->getId() ."' AND p.product_id in ('71','29','30','31','33','35','102','42','43','44','45','127') ORDER BY p.date_added DESC LIMIT " . (int)$limit);


venkat@morrisnphilip
anyone tested this? because this is what i'm looking for.. i'm using v1.3.4 and i'm very satisfied with this version. if anyone can help me with this situation it will be much appriciated.

Thank you.

Newbie

Posts

Joined
Thu Apr 29, 2010 8:30 pm

Post by maema » Fri Apr 30, 2010 10:23 pm

hello,

I tested..but not working...
I made my own just few post before with my poor knowledge (take 4h todo it).

So mister specialist how to write the correct php to do this:
first sort by location... then by date ?
location is priority of course.


and how to transform location field in admin in order to have a popup with fixed value (values will be in the source code of course, no need to be edited) ?

New member

Posts

Joined
Fri Nov 27, 2009 3:38 am
Who is online

Users browsing this forum: No registered users and 36 guests