Go: Ecshop product category page Get album list method

Source: Internet
Author: User

Ecshop Product category page Get album list method

A long time ago I saw you in the Product List page has access to the album list, but has not practiced, it should be quite simple, but the recent hand on the project just need this function, and then think of the online search for information, at least find a way to do it, but Baidu Google, incredibly did not find any answer. Just in Baidu know to see someone mentioned this problem, incredibly no answer!

Search this clue broken, we have a plan B, is to develop themselves, haha. Someone on the internet asked this question, but the answer to the person that is two times to develop AH what, of course, hello default function is not so perfect, we need to further modify the next, but two times the development is not really so difficult, anyway, I do not believe this, I think I must be able to do it.

Careful analysis of the program code, found that should not be difficult, as long as the product ID number according to the list, through this ID number to obtain the corresponding Picture album list, and then in the product listing in the cycle show can be, say simple, but they tried a lot of ways, found that it is not good, exactly where the problem is. The result after a few hours of effort, finally is realized, please forgive small I am a program small white ...

This is a picture that has not been modified:

This is the modified:


1th step: Find the root directory of the category.php file, look for about: 486 rows or so (note that this is not the exact location, see the actual OH), find this function:

/**
* Get the product under classification
*
* @access Public
* @param string $children
* @return Array
*/
function Category_get_goods ($children, $brand, $min, $max, $ext, $size, $page, $sort, er)
...... The following code is omitted.

And then in this function:

if ($watermark _img! = ")
{
$arr [$row [' goods_id ']][' watermark_img '] = $watermark _img;
}

$arr [$row [' goods_id ']][' goods_id '] = $row [' goods_id '];

Add a piece of code to the following line:

Call thumbnail 2014-05-26 11:24:12
$gid = $row [' goods_id '];
$SQLG = "Select Img_url,thumb_url from". $GLOBALS [' ECS ']->table (' goods_gallery '). " WHERE goods_id = ". $gid;
$ggres 2 = $GLOBALS [' db ']->getall ($SQLG);
Print_r ($ggres 2);

The general meaning is: Through the list of Product ID number, to find the corresponding product album in the thumbnail set, the return should be an image address array! (How many hours did it take to get this code?) Small series is really stupid ah ... )

And then find it down here:

$arr [$row [' goods_id ']][' goods_img '] = Get_image_path ($row [' goods_id '], $row [' goods_img ']);
$arr [$row [' goods_id ']][' url '] = Build_uri (' goods ', array (' gid ' = $row [' goods_id ']), $row [' goods_name ']);

Follow along with a code:

$arr [$row [' goods_id ']][' gpic '] = $ggres 2;

OK, the modification is half done, and the rest is called in the template.

2nd Step: Modify the Library file Library/goods_list.lbi.

In this file, find the location where you need to invoke the small picture of the product album so that the call can:

<!--{foreach from= $goods. gpic item=picture name=no}-->
<!--{if $smarty. foreach.no.iteration < 5}-

<!--{/if}-->
<!--{/foreach}-->

I use "{if $smarty. foreach.no.iteration < 5}" to limit the number of calls to 4, the friend you need can modify this number.

In this article, we use Smarty to loop through an array of album addresses, and note the From = $goods here. GPIC, the majority of the parameters we've seen from the back are just a name, such as from = $goods _list, but today I try to use the From = $goods. In this form of GPIC, it is also possible to recycle the array, which is really so simple.

Go: Ecshop product category page Get album list method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.