Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

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

Add extra class to input


Reply


8 Posts   1042 Views

Avatar
Josua

Community Member, 86 Posts

2 May 2012 at 11:23pm

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

Avatar
Jedateach

Forum Moderator, 232 Posts

3 May 2012 at 9:54am

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

Avatar
Josua

Community Member, 86 Posts

4 May 2012 at 3:55am

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

Avatar
Jedateach

Forum Moderator, 232 Posts

4 May 2012 at 9:48am

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

Avatar
Jedateach

Forum Moderator, 232 Posts

4 May 2012 at 12:21pm

Edited: 04/05/2012 12:22pm

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.

Avatar
Josua

Community Member, 86 Posts

4 May 2012 at 7:24pm

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

Avatar
Jedateach

Forum Moderator, 232 Posts

5 May 2012 at 10:05am

Hi Jose,

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

[url]http://demo.ss-shop.org/[/url]

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

regards,
Jeremy

Avatar
steve_seere

Community Member, 1 Post

7 July 2012 at 11:34am

Jedateach,

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