public function actionImageDown($id, $languageId)
    {
        $productImage = ProductImage::findOne($id);
        if (\Yii::$app->user->can('updateProduct', ['productOwner' => Product::findOne($productImage->product_id)->owner])) {

            if ($productImage) {
                $productImage->moveNext();
                $this->trigger(self::EVENT_AFTER_EDIT_PRODUCT, new ProductEvent([
                    'id' => $productImage->product_id
                ]));
            }
            return $this->actionAddImage($productImage->product_id, $languageId);
        } else throw new ForbiddenHttpException(\Yii::t('shop', 'You have not permission to do this action.'));
    }
public function actionImageDown($id, $languageId)
    {
        $productImage = ProductImage::findOne($id);
        if (\Yii::$app->user->can('updateProduct', ['productOwner' => Product::findOne($productImage->product_id)->owner])) {

            if ($productImage) {
                $productImage->moveNext();
                $this->trigger(self::EVENT_AFTER_EDIT_PRODUCT, new ProductEvent([
                    'id' => $productImage->product_id
                ]));
            }
            return $this->actionAddImage($productImage->product_id, $languageId);
        } else throw new ForbiddenHttpException(\Yii::t('shop', 'You have not permission to do this action.'));
    }
public function actionImageDown ( $ id , $ languageId ) { $ productImage = ProductImage :: findOne ( $ id ) ; if ( \ Yii :: $ app -> user -> can ( 'updateProduct' , [ 'productOwner' => Product :: findOne ( $ productImage -> product_id ) -> owner ] ) ) { if ( $ productImage ) { $ productImage -> moveNext ( ) ; $ this -> trigger ( self :: EVENT_AFTER_EDIT_PRODUCT , new ProductEvent ( [ 'id' => $ productImage -> product_id ] ) ) ; } return $ this -> actionAddImage ( $ productImage -> product_id , $ languageId ) ; } else throw new ForbiddenHttpException ( \ Yii :: t ( 'shop' , 'You have not permission to do this action.' ) ) ; }
Changes ProductImage position to down

Users which have 'updateOwnProduct' permission can change position only for ProductImage models that have been created by their.
Users which have 'updateProduct' permission can change position for all ProductImage models.

@param integer $id
@param integer $languageId
@return mixed
@throws ForbiddenHttpException
Changes ProductImage position to down