Ejemplo n.º 1
0
 public static function addProductOptions($data, $product)
 {
     $count = count($data['pogSort']);
     $ii = 0;
     //set counter for items
     if ($count > 0) {
         for ($i = 0; $i < count($data['pogSort']); $i++) {
             $optionGroup = StoreProductOptionGroup::add($product, $data['pogName'][$i], $data['pogSort'][$i]);
             $pogID = $optionGroup->getID();
             //add option items
             $itemsInGroup = count($data['optGroup' . $i]);
             if ($itemsInGroup > 0) {
                 for ($gi = 0; $gi < $itemsInGroup; $gi++, $ii++) {
                     StoreProductOptionItem::add($product, $pogID, $data['poiName'][$ii], $data['poiSort'][$ii]);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public static function addProductOptions($data, $product)
 {
     StoreProductOptionGroup::removeOptionGroupsForProduct($product, $data['pogID']);
     StoreProductOptionItem::removeOptionItemsForProduct($product, $data['poiID']);
     $count = count($data['pogSort']);
     $ii = 0;
     //set counter for items
     if ($count > 0) {
         for ($i = 0; $i < count($data['pogSort']); $i++) {
             if (isset($data['pogID'][$i])) {
                 $optionGroup = StoreProductOptionGroup::getByID($data['pogID'][$i]);
                 if ($optionGroup) {
                     $optionGroup->update($product, $data['pogName'][$i], $data['pogSort'][$i]);
                 }
             }
             if (!$optionGroup) {
                 if ($data['pogName'][$i]) {
                     $optionGroup = StoreProductOptionGroup::add($product, $data['pogName'][$i], $data['pogSort'][$i]);
                 }
             }
             if ($optionGroup) {
                 $pogID = $optionGroup->getID();
                 //add option items
                 $itemsInGroup = count($data['optGroup' . $i]);
                 if ($itemsInGroup > 0) {
                     for ($gi = 0; $gi < $itemsInGroup; $gi++, $ii++) {
                         if ($data['poiID'][$ii] > 0) {
                             $option = StoreProductOptionItem::getByID($data['poiID'][$ii]);
                             if ($option) {
                                 $option->update($product, $data['poiName'][$ii], $data['poiSort'][$ii], $data['poiHidden'][$ii]);
                             }
                         } else {
                             if ($data['poiName'][$ii]) {
                                 StoreProductOptionItem::add($product, $pogID, $data['poiName'][$ii], $data['poiSort'][$ii], $data['poiHidden'][$ii]);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public static function getOptionItemsForProductOptionGroup(ProductOptionGroup $pog)
 {
     $db = Database::connection();
     $em = $db->getEntityManager();
     return $em->getRepository('Concrete\\Package\\VividStore\\Src\\VividStore\\Product\\ProductOption\\ProductOptionItem')->findBy(array('pogID' => $pog->getID()));
 }
Ejemplo n.º 4
0
                                <a class="btn-cart-list-remove"  href="javascript:vividStore.removeItem(<?php 
            echo $k;
            ?>
, true);"><?php 
            echo t("Remove");
            ?>
</a>
                            </div>
                            <?php 
            if ($cartItem['productAttributes']) {
                ?>
                                <div class="cart-list-item-attributes">
                                    <?php 
                foreach ($cartItem['productAttributes'] as $groupID => $valID) {
                    $groupID = str_replace("pog", "", $groupID);
                    $optiongroup = StoreProductOptionGroup::getByID($groupID);
                    $optionvalue = StoreProductOptionItem::getByID($valID);
                    ?>
                                        <div class="cart-list-item-attribute">
                                            <span class="cart-list-item-attribute-label"><?php 
                    echo $optiongroup ? $optiongroup->getName() : '';
                    ?>
:</span>
                                            <span class="cart-list-item-attribute-value"><?php 
                    echo $optionvalue ? $optionvalue->getName() : '';
                    ?>
</span>
                                        </div>
                                    <?php 
                }
                ?>
Ejemplo n.º 5
0
 public function remove()
 {
     StoreProductImage::removeImagesForProduct($this);
     StoreProductOptionGroup::removeOptionGroupsForProduct($this);
     StoreProductOptionItem::removeOptionItemsForProduct($this);
     StoreProductFile::removeFilesForProduct($this);
     StoreProductGroup::removeGroupsForProduct($this);
     StoreProductLocation::removeLocationsForProduct($this);
     StoreProductUserGroup::removeUserGroupsForProduct($this);
     StoreProductVariation::removeVariationsForProduct($this);
     $em = Database::get()->getEntityManager();
     $em->remove($this);
     $em->flush();
     $page = Page::getByID($this->cID);
     if (is_object($page)) {
         $page->delete();
     }
 }