1999 Posts in 530 Topics by 433 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, Jedateach, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 670 Views |
-
Add extra class to input

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 -
Re: Add extra class to input

3 May 2012 at 9:54am
The Shop module has a EcomQuantityField.ss that you can override to create your own, including updating classes.
-
Re: Add extra class to input

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 -
Re: Add extra class to input

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
-
Re: Add extra class to input

4 May 2012 at 12:21pm Last edited: 4 May 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.
-
Re: Add extra class to input

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 -
Re: Add extra class to input

5 May 2012 at 10:05am
Hi Jose,
I have updated the shop demo site with my bootstrap theme:
Git repositories for the theme:
https://github.com/burnbright/silverstripe-bootstrap
https://github.com/burnbright/silverstripe-bootstrap-shopregards,
Jeremy -
Re: Add extra class to input

7 July 2012 at 11:34am
Jedateach,
That's an excellent theme for the shop! Looks very professional. Thank you for that.
| 670 Views | ||
|
Page:
1
|
Go to Top |


