function confirm() { //Generate a new basket item $Item = new OrderItem(); $Basket = $this->_fetchBasket(); $Title = array(); foreach ($Basket['items'] as $Option) { if ($Option->type == 'Style') { $Item->image($Option->image); } $String = $Option->type . ': ' . $Option->title; if (isset($Option->variant)) { $String .= ' (' . $Option->variant . ')'; } $Title[] = $String; } $Item->title('Custom Order'); $Item->subtitle(implode($Title, ' & ')); $Item->source('custom:' . substr(md5(time()), 0, 6)); $Item->quantity(1); $Item->hidden(json_encode($this->basket)); $Item->price($Basket['total']); $Item->addToOrder(); $this->clear(); redirect('/checkout/'); }
function fromOrderItem(OrderItem $Item) { $this->title = $Item->title(); $this->subtitle = $Item->subtitle(); $this->quantity = $Item->quantity(); $this->hidden = $Item->hidden(); $this->price = $Item->price(); $this->image = $Item->image(); list($Source, $ID) = $Item->source(); if ($Source == 'shop') { $this->storeitem = $ID; } }
function addtocart($ProductID) { //Generate a new basket item $Item = new OrderItem(); $Product = new mStoreItem($ProductID); $Item->title($Product->title); $Item->source('shop:' . $Product->id()); $Item->subtitle($Product->description); $Item->quantity(1); $Item->image($Product->main_image()->filename); $Item->hidden(json_encode($Product->_data)); $Item->price($Product->price); $Item->addToOrder(); redirect('/checkout/'); }