Forum

Thread tagged as: Question, Shop

Perch Item Index and Pagination

Hi,

I am adding some ecommerce tracking to my Shop site, one feature of which is tracking product views when in a list, part of which is the position of the product. My function looks like this:

perch_shop_products([
  'template' => 'products/category_grid',
  'sort' => 'priority',
  'sort-order' => 'ASC',
  'sort-type' => 'numeric',
  'count' => 24,
  'paginate' => true
]);

I thought I could use perch_item_index for the product position in the listing, but this resets on each page. Is there a way to get the product's overall position rather than the position on the page?

Thanks for any help

Mike

Mike Harrison

Mike Harrison 37 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There isn't, but you can get the page number of course. That should give you the same information.

Ah good thought - yes I could use that combined with the index and a bit of maths. Thanks!