public function extract(Model $model) { $data['option_id'] = $model->getOptionId(); $data['name'] = $model->getName(); $data['instruction'] = $model->getInstruction(); $data['required'] = $model->getRequired() ? 1 : 0; $data['builder'] = $model->getBuilder() ? 1 : 0; $data['option_type_id'] = $model->getOptionTypeId(); return $data; }
public function createCartItem($item, Option $parentOption = null, $uomString = null, $quantity = 1) { $cartItem = new CartItem(array('metadata' => new CartItemMeta(array('uom' => $uomString, 'item_number' => $item->getItemNumber(), 'image' => $item->has('image') ? $item->getImage() : null, 'parent_option_id' => $parentOption ? $parentOption->getOptionId() : null, 'parent_option_name' => $parentOption ? $parentOption->__toString() : null, 'flat_options' => $parentOption ? null : $this->flatOptions, 'product_id' => $parentOption ? null : $item->getProductId())), 'description' => $item->__toString(), 'quantity' => $quantity, 'price' => $parentOption ? $item->getAddPrice() : $this->getPriceForUom($uomString))); $this->addOptions($item->getOptions(), $cartItem); return $cartItem; }