Jump to:

2088 Posts in 1008 Topics by 455 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Product rows

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 599 Views
  • aarono
    Avatar
    Community Member
    34 Posts

    Product rows Link to this post

    Hi there

    This is my first time using the forum so please bear with me

    Im trying to get all the products to appear in a rows of 4. So every set of 4 product items would be containted in a <div class="product_row">. I figured it would need to use modulus for this so i made a function:

    function startRow() {
       if(($this->Pos() % 4)==1) {
          return true;
       }
    }

    that works fine to start the row. however if i use the same idea to end it

    function endRow() {
       if(($this->Pos() % 4)==0) {
          return true;
       }
    }

    and i dont have an amount of products that is a multiple of 4 (4, 8, 12, 16 etc), it wont close the div.

    Can anyone help?

    Cheers,
    Aaron

    EDIT - SOLVED. the answer was right infront of me. if(($this->Pos() % 4)==0 || $this->Last())

    599 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.