| Conditions | 7 |
| Paths | 7 |
| Total Lines | 29 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 39 | public function index() |
||
| 40 | { |
||
| 41 | $request = $this->getRequest(); |
||
| 42 | |||
| 43 | if (!$request->getVar('code')) { |
||
| 44 | return 'Code is required'; |
||
| 45 | } |
||
| 46 | |||
| 47 | if (!$request->getVar('price') && $request->getVar('price') != 0) { |
||
| 48 | return 'Price is required'; |
||
| 49 | } |
||
| 50 | |||
| 51 | if (!$request->getVar('name')) { |
||
| 52 | return 'Name is required'; |
||
| 53 | } |
||
| 54 | |||
| 55 | $code = $request->getVar('code'); |
||
| 56 | $props = []; |
||
| 57 | foreach ($request->getVars() as $var => $val) { |
||
| 58 | $props[$var] = AddToCartForm::getGeneratedValue($code, $var, $val, 'value'); |
||
| 59 | } |
||
| 60 | |||
| 61 | $post_url = ''; |
||
| 62 | foreach ($props as $key => $value) { |
||
| 63 | $post_url .= $key . '=' . $value . '&'; |
||
| 64 | } |
||
| 65 | $post_url = rtrim($post_url, '&'); |
||
| 66 | |||
| 67 | echo FoxyHelper::StoreURL() . '/cart?' . $post_url; |
||
| 68 | } |
||
| 70 |