/** * @return \DVDoug\BoxPacker\PackedBoxList */ public function getPackages() { $packer = new ClerkPacker(); $boxes = StoreClerkPackage::getPackages(); foreach ($boxes as $box) { $packer->addBox($box); } $cartItems = StoreCart::getCart(); foreach ($cartItems as $cartItem) { $product = StoreProduct::getByID((int) $cartItem['product']['pID']); $description = $product->getProductName(); $width = StoreCalculator::convertToMM($product->getDimensions('w')); $length = StoreCalculator::convertToMM($product->getDimensions('l')); $depth = StoreCalculator::convertToMM($product->getDimensions('h')); $weight = StoreCalculator::convertToGrams($product->getProductWeight()); $packer->addItem(new StoreClerkItem($description, $width, $length, $depth, $weight)); //TODO: If an item doesn't fit in any box, make it it's own box. } return $packer->pack(); }
public function delete($id) { StoreClerkPackage::getByID($id)->delete(); $this->redirect('/dashboard/store/settings/shipping/clerk/removed'); }