Cheat Sheet [abc] A single character of: a, b or c [^abc] Any single character except: a, b, or c [a-z] Any single character in the range a-z [a-zA-Z] Any single character in the range a-z or A-Z ^ Start of line $ End of line \A Start of string \z End of string . Any single character \s Any whitespace character \S Any non-whitespace character \d Any digit \D Any non-digit \w Any word character (letter, number, underscore) \W Any non-word character \b Any word boundary (...) Capture everything enclosed (a|b) a or b a? Zero or one of a a* Zero or more of a a+ One or more of a a{3} Exactly 3 of a a{3,} 3 or more of a a{3,6} Between 3 and 6 of a Options i case insensitive m treat as multi-line string s dot matches newline x ignore whitespace in regex A matches only at the start of string D matches only at the end of string U non-greedy matching by default
Search
Aug 26, 2015
Regex in string php
http://www.phpliveregex.com/
Aug 18, 2015
Set type customer ( group_id ) from register form in Magento
Step 1: Go to admin -> System -> Config (default) -> Customer Config -> Create new account options (tab) -> Enable Automatic Assignment to Customer Group ( Set = No ) -> Save
Step 2: Edit file ../../Customer/controllers/AccountController.php (from Core file or Module file)
Step 3: Create register form with name="group_id"
Step 2: Edit file ../../Customer/controllers/AccountController.php (from Core file or Module file)
public function createPostAction() { ..... $customer = $this->_getCustomer(); // Start Mod if ($this->getRequest()->getPost('group_id')){ $customer->setGroupId(intval($this->getRequest()->getPost('group_id'))); } else $customer->getGroupId(); // End Mod ...... $customer->save(); ...... }
Step 3: Create register form with name="group_id"
<div class="form-group"> <label class="radio-inline" for="group_id"> <input type="radio" name="group_id" value="3">Retailer</label> <label class="radio-inline" for="group_id"> <input type="radio" name="group_id" value="4">Designer</label> <label class="radio-inline" for="group_id"> <input type="radio" name="group_id" value="5">Hospitality</label> </div>
Subscribe to:
Posts (Atom)