dneustadt /
DnVariantSwitch
| 1 | <?php |
||
| 2 | |||
| 3 | class Shopware_Controllers_Widgets_DnVariantSwitch extends \Enlight_Controller_Action |
||
|
0 ignored issues
–
show
|
|||
| 4 | { |
||
| 5 | public function variantSwitchFormAction() |
||
| 6 | { |
||
| 7 | $basketID = $this->Request()->get('basketId'); |
||
| 8 | $articleID = $this->Request()->get('articleId'); |
||
| 9 | $number = $this->Request()->get('number'); |
||
| 10 | $quantity = $this->Request()->get('quantity'); |
||
| 11 | $offCanvas = $this->Request()->get('offCanvas'); |
||
| 12 | |||
| 13 | $context = $this->get('shopware_storefront.context_service')->getShopContext(); |
||
| 14 | $product = $this->get('shopware_storefront.list_product_service')->get($number, $context); |
||
| 15 | |||
| 16 | /** @var \Shopware\Bundle\StoreFrontBundle\Struct\ListProduct $product */ |
||
| 17 | if (!$product || !$product->hasConfigurator()) { |
||
|
0 ignored issues
–
show
|
|||
| 18 | return; |
||
| 19 | } |
||
| 20 | |||
| 21 | $this->view->hasActiveVariants = true; |
||
| 22 | |||
| 23 | $this->view->basketID = $basketID; |
||
| 24 | $this->view->articleID = $articleID; |
||
| 25 | $this->view->number = $number; |
||
| 26 | $this->view->quantity = $quantity; |
||
| 27 | $this->view->offCanvas = $offCanvas; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function switchVariantAction() |
||
| 31 | { |
||
| 32 | $this->get('front')->Plugins()->ViewRenderer()->setNoRender(); |
||
| 33 | |||
| 34 | $number = $this->Request()->get('sAdd'); |
||
| 35 | $quantity = (int)$this->Request()->get('sQuantity'); |
||
| 36 | $basketID = (int)$this->Request()->get('detailId'); |
||
| 37 | |||
| 38 | if(!empty($number) && !empty($basketID)){ |
||
| 39 | $this->get('dn.variant_switch')->switchVariant( |
||
| 40 | $number, |
||
| 41 | $basketID, |
||
| 42 | $this->get('modules')->Basket(), |
||
| 43 | $quantity |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | $this->Response()->setBody(json_encode(array('success' => true))); |
||
| 48 | } |
||
| 49 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths