Jump to:

2076 Posts in 857 Topics by 449 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Add extra class to input

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: 886 Views
  • Josua
    Avatar
    Community Member
    86 Posts

    Add extra class to input Link to this post

    Hi!

    Is there any way to add an extra class to an input of some form of ecommerce module?
    Eg
       <input type="text" class="ajaxQuantityField" name="Product_OrderItem_DB_38_Quantity_SetQuantityLink" value="1" maxlength="3" size="3" rel="shoppingcart/setquantityitem/26/Product/" />

    I want to add the class span2

    <input type="text" class="ajaxQuantityField span2" name="Product_OrderItem_DB_38_Quantity_SetQuantityLink" maxlength="3" size="3" rel="shoppingcart/setquantityitem/26/Product/" value="1" />

    Thanks,
    Regards,
    Jose

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Add extra class to input Link to this post

    The Shop module has a EcomQuantityField.ss that you can override to create your own, including updating classes.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: Add extra class to input Link to this post

    Jeremy thank you very much.
    But I'm looking for a general way to include a class to fields in a form already created. Whether in the ecommerce module, forum, blog, etc .
    I need to do this for integrate the classes of the Twitter Bootstrap framework in these modules.
    Do you know any way to do this ?

    Thanks,
    Regards,
    Jose

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Add extra class to input Link to this post

    Hi Jose,

    I've only just learned about the twitter bootstrap framework from your posts on the mailing list. It looks like a great starting point for theming the shop module. I'm planning to have a go at creating a shop theme mysyelf using the bootstrap framework.

    https://github.com/burnbright/silverstripe-shop/issues/47

    Jeremy

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Add extra class to input Link to this post

    Hi Jose,

    I've realized I didn't fully answer your question. To modify fields for existing, you'll need to look for the appropriate extension hook in the code.

    For example, for OrderForm you write something like:

    class MyCustomForm extends Extension{
    function updateForm($form){
    $form->Fields()->...do something...
    }
    }

    ...then apply the extension in your _config.php file:

    Object::add_extension('OrderForm','MyCustomForm');

    There are some hooks listed at the bottom of this page:
    http://demo.ss-shop.org/docs/developer/en/Development
    ..or you can search all module files for "->extend" ...to find hook locations.

    I've started having a go at creating a twitter bootstrap theme for shop, and have been rather successful so far, however I see what you mean by wanting to put a span1 class on input fields, particularly for the checkout page.

  • Josua
    Avatar
    Community Member
    86 Posts

    Re: Add extra class to input Link to this post

    Hi Jeremy!

    Yeah, I think the Twitter Bootstrap framework will be a great starting point theme for all users of the shop module.
    It is very powerful and is compatible with all types of devices and enable them to expand without limit.

    Thank you for the code that you have explained to me .
    I think that is the solution to my problem.

    Are you an artist.

    Again, many thanks.

    Regards,
    Jose

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Add extra class to input Link to this post

    Hi Jose,

    I have updated the shop demo site with my bootstrap theme:

    http://demo.ss-shop.org/

    Git repositories for the theme:
    https://github.com/burnbright/silverstripe-bootstrap
    https://github.com/burnbright/silverstripe-bootstrap-shop

    regards,
    Jeremy

  • steve_seere
    Avatar
    Community Member
    1 Post

    Re: Add extra class to input Link to this post

    Jedateach,

    That's an excellent theme for the shop! Looks very professional. Thank you for that.

    886 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.