Ejemplo n.º 1
0
 public function post_all()
 {
     $releases = Model_Release::query()->order_by('name')->get();
     $smarty = Nathan_Controller::new_smarty(array('releases' => $releases, 'image_dim' => count($releases) < 3 ? '400x400' : '230x230'));
     $html = $smarty->fetch(APPPATH . 'views/releases/releases.smarty');
     $this->response($html);
 }
Ejemplo n.º 2
0
 public function action_index()
 {
     if ($this->data['rels'] = explode('-', Cookie::get('divec_cart', ''))) {
         $this->data['rels'] = Model_Release::find()->where('id', 'IN', $this->data['rels'])->get();
     }
     // TODO: just calculate the final amount in the paypal plugin
     // Also, allow for multiples of a particular item to be calculated
     /*$amt = 0;
     		foreach($this->data['rels'] as $rel) {
     			$amt += $rel->price;
     		}
     		$this->data['amt'] = $amt;*/
     $this->template->body = 'checkout/index_checkout.smarty';
 }
Ejemplo n.º 3
0
 public function item_view()
 {
     $rel_trans = DB::select('release_id', 'quantity')->from('releases_transactions')->where('transaction_id', $this->item->id)->execute()->as_array();
     if ($rel_trans) {
         $header = html_tag('tr', array('class' => 'table-header'), html_tag('th', array(), 'Release') . html_tag('th', array(), 'Quantity'));
         $body = '';
         foreach ($rel_trans as $rt) {
             if ($rel = Model_Release::find($rt['release_id'])) {
                 $name = html_tag('a', array('href' => "/admin/item/releases?id={$rel->id}"), $rel->name);
             } else {
                 $name = "Error: Release #{$rt['release_id']} no longer exists.";
             }
             $body .= html_tag('tr', array(), html_tag('td', array(), $name) . html_tag('td', array(), $rt['quantity']));
         }
         return html_tag('table', array('class' => 'trans-rel-table'), $header . $body);
     }
     return "<p>No data.</p>";
 }
Ejemplo n.º 4
0
 public function load_params()
 {
     parse_str(Input::post('attr'), $attr);
     parse_str(Input::post('rels'), $rels);
     $amt = 0;
     foreach ($rels['quantity'] as $rel_id => $quantity) {
         if ($rel = Model_Release::find($rel_id)) {
             $this->releases[$rel->id] = $quantity;
             $amt += $rel->price * $quantity;
         }
     }
     $expdate = $attr['cc_exp_month'] . $attr['cc_exp_year'];
     if (strlen($expdate) < 6) {
         $expdate = '0' . $expdate;
     }
     $params = array('PAYMENTACTION' => 'Sale', 'AMT' => $amt, 'ACCT' => $attr['acct'], 'CVV2' => $attr['cvv2'], 'EXPDATE' => $expdate, 'CREDITCARDTYPE' => $attr['creditcardtype'], 'STREET' => $attr['street'], 'CITY' => $attr['city'], 'STATE' => $attr['state'], 'ZIP' => $attr['zip'], 'COUNTRYCODE' => $attr['countrycode'], 'FIRSTNAME' => $attr['firstname'], 'LASTNAME' => $attr['lastname']);
     $shipping = array('ship_city' => $attr['ship_city'], 'ship_zip' => $attr['ship_zip'], 'ship_street' => $attr['ship_street'], 'ship_state' => $attr['ship_state']);
     return array($params, $shipping);
 }
Ejemplo n.º 5
0
 public function action_index()
 {
     $this->data['releases'] = Model_Release::find('all');
     $this->template->body = 'home/index_home.smarty';
 }