LemonStand Forum: When records_per_page is set to 1 shop:product_list bails - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

When records_per_page is set to 1 shop:product_list bails

#1 User is offline   infradawn 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 85
  • Joined: 19-April 10

Posted 28 August 2010 - 10:49 PM

The following behaviour was reproduced in the demo store.

Add line 8 to shop:product_list partial to force 1 record per page:

7        $records_per_page = isset($records_per_page) ? $records_per_page : 3;
8        $records_per_page = 1;
9        $pagination = $products->paginate($page_index, $records_per_page);


Navigate to any category in the store Catalog, e.g. Photography and:

Fatal error: Call to a member function is_discounted() on a non-object in /home/lemony/sites/demo_new/modules/cms/classes/cms_controller.php(268) : eval()'d code on line 16


I don't currently use 1 record per page functionality, I was just testing my 'show per page' controls. But I can see that being able to scroll through a category 1 product at a time, for example with a full product description on each page, would be useful.

Thanks

iD


In case you get 2 emails, I added this bug report a second time this morning. Last nights site hiccup lost the first one :)
0

#2 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 29 August 2010 - 02:40 PM

Hi. iD!

It is a quirk of the default ActiveRecord implementation. I updated the base class and now the find_all() method will always be returning Db_DataCollection. I tested it with 1 product per page pagination. The update will be published today.

Thanks

#3 User is offline   infradawn 

  • Member
  • PipPipPip
  • Group: Members
  • Posts: 85
  • Joined: 19-April 10

Posted 30 August 2010 - 10:42 AM

Hi Aleksey,

Does that also 'fix' the need for this line in public function search() ?

if ($records < 2)
   $records = 2;



:)

iD
0

#4 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 30 August 2010 - 02:26 PM

Hi, iD!

You are right. I will publish the update today. Thanks!

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users