static function upgrade($version)
 {
     $db = Database::instance();
     if ($version == 1) {
         // fix for allowing decimel place in money
         $db->query("ALTER TABLE {products} CHANGE COLUMN `cost` `cost` DECIMAL(10,2) default 0;");
         $db->query("ALTER TABLE {item_products} CHANGE COLUMN `cost` `cost` DECIMAL(10,2) default -1;");
         // postage bands
         $db->query("ALTER TABLE {products} ADD COLUMN `postage_band_id` int(9) default 1");
         $db->query("CREATE TABLE IF NOT EXISTS {postage_bands} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` TEXT NOT NULL,\n                 `flat_rate` DECIMAL(10,2) default 0,\n                 `per_item` DECIMAL(10,2) default 0,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         postage_band::create("No Postage", 0, 0);
         module::set_version("basket", $version = 2);
     }
     if ($version == 2) {
         $db->query("CREATE TABLE IF NOT EXISTS {orders} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `text` TEXT NOT NULL,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
         basket::setPaymentDetails("<p>Use the following options to pay for this order.</p>\n<p>Send a chequre to..</p>\n<p>Visit the shop..</p>\n<p>By using internet banking..</p>");
         basket::setOrderPrefix("ORDER");
         basket::setOrderCompletePage("<p>Your order number is %order_number. To pay for this order please either:</p>\n<p> - Send a cheque for %total_cost to with reference %order_number..</p>\n<p> - Visit the shop and quote the order %order_number..</p>\n<p> - Transfer %total_cost using internet banking with reference %order_number..</p>\n<p>Order will be processed as soon as payment is received. You should receive an e-mail with your order details shortly.</p>");
         basket::setOrderCompleteEmail("Hi %name,\n\nThank you for your order the order details are below. To pay for this order please either:\n\n- Send a cheque for %total_cost to with reference %order_number..\n- Visit the shop and quote the order %order_number..\n- Transfer %total_cost using internet banking with reference %order_number..\n\nOrder will be processed as soon as payment is received. For order pick-ups please visit..\n\nOrder Details\n-------------\n%order_details\n\nThanks");
         basket::setOrderCompleteEmailSubject("Photography Order %order_number");
         module::set_version("basket", $version = 3);
     }
     if ($version == 3) {
         $db->query("ALTER TABLE {orders} ADD COLUMN `status` int(9) DEFAULT 0;");
         $db->query("CREATE TABLE IF NOT EXISTS {ipn_messages} (\n        `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n        `date`  int(11) NOT NULL,\n        `key` varchar(20) NOT NULL,\n        `txn_id` varchar(20) NOT NULL,\n        `status` varchar(20) NOT NULL,\n        `success` bool default false,\n        `text` text,\n        PRIMARY KEY  (`id`)\n      ) ENGINE=InnoDB  DEFAULT CHARSET=utf8;");
         module::set_version("basket", $version = 4);
     }
     if ($version == 4) {
         $db->query("ALTER TABLE {orders} ADD COLUMN `name` varchar(1024);");
         $db->query("ALTER TABLE {orders} ADD COLUMN `email` varchar(1024);");
         $db->query("ALTER TABLE {orders} ADD COLUMN `method` int(9) DEFAULT 0;");
         $db->query("ALTER TABLE {orders} ADD COLUMN `cost` DECIMAL(10,2) default 0");
         module::set_version("basket", $version = 5);
     }
 }
 static function getProductArray()
 {
     $products = ORM::factory("product")->find_all();
     foreach ($products as $product) {
         $producta[$product->id] = $product->description . " (" . basket::formatMoney($product->cost) . ")";
     }
     return $producta;
 }
Exemple #3
0
 public function to_basketAction()
 {
     if ($goods = ormPages::get(system::url(2), 'goods')) {
         $count = system::issetUrl(3) ? system::url(3) : 1;
         basket::addGoods($goods, $count);
     }
     system::redirect('/eshop/basket');
 }
 static function photo_top($theme)
 {
     if (!basket::is_side_bar_only()) {
         if (product::isForSale($theme->item()->id)) {
             $view = new View("add_to_basket.html");
             $view->item = $theme->item();
             return $view->render();
         }
     }
     return "";
 }
Exemple #5
0
 static function extractForm($form)
 {
     $email = $form->configure->email->value;
     $isPaypal = $form->configure->paypal->value;
     $paypal_account = $form->configure->paypal_account->value;
     $currency = $form->configure->currency->selected;
     basket::setEmailAddress($email);
     basket::setPaypal($isPaypal);
     basket::setPaypalAccount($paypal_account);
     basket::setCurrency($currency);
 }
 /**
  * the index page of the user homes admin
  */
 public function templates()
 {
     $form = basket::get_template_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             basket::extractTemplateForm($form);
             message::success(t("Basket Module Configured!"));
         }
     } else {
         basket::populateTemplateForm($form);
     }
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_templates.html");
     $view->content->form = $form;
     print $view;
 }
 /**
  * the index page of the user homes admin
  */
 public function index()
 {
     $form = basket::get_configure_form();
     if (request::method() == "post") {
         // @todo move the "save" part of this into a separate controller function
         access::verify_csrf();
         if ($form->validate()) {
             basket::extractForm($form);
             message::success(t("Basket Module Configured!"));
             //url::redirect("admin/recaptcha");
         }
     } else {
         basket::populateForm($form);
     }
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_configure.html");
     $view->content->form = $form;
     //$view->content->products = ORM::factory("product")->orderby("name")->find_all();
     print $view;
 }
?>
" class="<?php 
echo text::alternate("g-odd", "g-even");
?>
">
        <td id="product-<?php 
echo $product->id;
?>
" class="core-info ">
          <?php 
echo html::clean($product->name);
?>
  </td>
  <td>
    <?php 
echo basket::formatMoney($product->cost);
?>
        </td>
  <td>
    <?php 
echo html::clean($product->description);
?>
  </td>
  <td>
    <?php 
echo html::clean($product->postage_band->name);
?>
  </td>


    <td>
?>
        </div>
        </td>
        <td>
          <?php 
echo html::clean($prod_details->product_description());
?>
        </td>
        <td>
          <?php 
echo html::clean($prod_details->quantity);
?>
        </td>
        <td>
          <?php 
echo basket::formatMoney($prod_details->cost);
?>
        </td>
    </tr>
      <? endforeach ?>
      <tr id="" class="<?php 
echo text::alternate("gOddRow", "gEvenRow");
?>
">
        <td></td><td></td><td>Total Cost</td><td><?php 
echo $basket->cost();
?>
</td>
      </tr>

   </table>
Exemple #10
0
		<?php 
}
?>

		<br>
				
	
		<a href="/catalog" class="floatleft size12">Продолжить покупки?</a>
		
		<?php 
if (isset($_SESSION['user_id'])) {
    ?>
			Итого: <span class="itogo_sum"><?php 
    echo basket::format_Cost(basket::get_Total_Goods() + basket::get_Cost_Deliver($_SESSION['user_id'], basket::get_Total_Goods()));
    ?>
</span><span class="rub">a</span>
		<?php 
} else {
    ?>
			Итого: <span class="itogo_sum"><?php 
    echo basket::format_Cost(basket::get_Total_Goods());
    ?>
</span><span class="rub">a</span>
		<?php 
}
?>
			
			
	</div>

</div>
<?php

$id_good = intval($_POST['id']);
$_kolvo = intval($_POST['value']);
// если подстава
if ($id_good == 0 or $_kolvo == 0) {
    die('Товар не найден!');
}
// если ве гуд
require "../main.php";
// строим запрос
$_sql = "select cost from `catalog` where id=" . $id_good . " and status=1";
// выполняем запрос + при необходимости выводим сам запрос
$result = mysql::query_one($_sql, 0);
// закидываем товар в сессию
if (isset($_SESSION['basket'][$id_good])) {
    foreach ($_SESSION['basket'] as $key => $value) {
        if ($key == $id_good) {
            $_SESSION['basket'][$key] = array('id' => $id_good, 'cost' => $result->cost, 'kolvo' => $_kolvo);
        }
    }
}
// результат
die(json_encode(array('count' => basket::get_Count_Goods(), 'total' => basket::get_Total_Goods(), 'basket' => system::show_tpl(array('result' => basket::show_Basket()), 'frontend/basket/list.php'))));
Exemple #12
0
			</div>
		</td>
		<td class="cart_name">
			<div class="row"><a href="/catalog/goods/<?php 
        echo $obj->id_good;
        ?>
"><?php 
        echo basket::get_Good_Data($obj->id_good)->name;
        ?>
</a></div>
			<div class="cart_name_cost"><?php 
        echo $obj->cost;
        ?>
 <span class="rub">a</span></div>
		</td>
		<td class="cart_kolvo">
			<?php 
        echo $obj->kolvo;
        ?>
		</td>
		<td class="cart_summa">
			<div class="cart_summa_wrap"><?php 
        echo basket::format_Cost($obj->cost * $obj->kolvo);
        ?>
 <span class="rub">a</span></div>
		</td>
	</tr>		

<?php 
    }
}
<?php

defined("SYSPATH") or die("No direct script access.");
?>
<div class="g-block">
<div id="b-complete">
<h2>Thankyou for your order</h2>
<?php 
if ($order->method == Order_Model::PAYMENT_PAYPAL) {
    ?>
Your order will be confirmed when Paypal has finished processing your order.<?php 
} else {
    echo basket::replaceStrings(basket::getOrderCompletePage(), array("order_number" => $ordernumber, "total_cost" => basket::formatMoneyForWeb($total_cost)));
}
?>
</div>
</div>
		
		Стоимость доставки:
		<span class="itogo_sum">
			<?php 
    echo basket::get_Cost_Deliver($_SESSION['user_id'], mycabinet::get_Total_Order($obj->id)->total);
    ?>
		</span>
		<span class="rub">
			a
		</span>
		
		<br>
		
		Всего:
		<span class="itogo_sum">
			<?php 
    echo basket::format_Cost(mycabinet::get_Total_Order($obj->id)->total + basket::get_Cost_Deliver($_SESSION['user_id'], mycabinet::get_Total_Order($obj->id)->total));
    ?>
		</span>
		<span class="rub">
			a
		</span>
	</div>	
	
	
<?php 
}
?>
	

            echo basket::formatMoneyForWeb($prod_details->cost);
            ?>
</td>
<td class="g-actions"><a href="<?php 
            echo url::site("basket/remove_item/{$key}");
            ?>
" class="g-button ui-state-default ui-corner-all ui-icon-left"><span class="ui-icon ui-icon-trash"></span></a></td>
</tr><?php 
        }
        ?>
<tr class="<?php 
        echo text::alternate("gOddRow", "gEvenRow");
        ?>
">
<td>Total</td><td id="total"><?php 
        echo $basket->ispp() ? basket::formatMoneyForWeb($total + $postage) : basket::formatMoneyForWeb($total);
        ?>
</td><td></td>
</tr></table></div><br/>
<p><a class="g-button right ui-icon-left ui-state-default ui-corner-all ui-state-hover" href="<?php 
        echo url::site("basket/view_basket");
        ?>
" title="<?php 
        echo t("Checkout");
        ?>
"><span class="ui-icon ui-icon-cart"></span><?php 
        echo t("Checkout");
        ?>
</a></p><?php 
    }
}
Exemple #16
0
<?php 
}
?>
	

	<tr>
		<td colspan="3"><strong>Итого:</strong></td>
		<td align="center"><strong><?php 
echo mycabinet::get_Total_Order($obj->number_order)->total;
?>
</strong></td>
	</tr>		
	
	<tr>
		<td colspan="3"><strong>Доставка:</strong></td>
		<td align="center"><strong><?php 
echo basket::get_Cost_Deliver($_SESSION['user_id'], mycabinet::get_Total_Order($obj->number_order)->total);
?>
</strong></td>
	</tr>	
	
	<tr>
		<th colspan="3"><strong>Всего:</strong></th>
		<th align="center"><strong><?php 
echo mycabinet::get_Total_Order($obj->number_order)->total + basket::get_Cost_Deliver($_SESSION['user_id'], mycabinet::get_Total_Order($obj->number_order)->total);
?>
</strong></th>
	</tr>		


	</table>
        <td id="product-<?php 
    echo $postage_band->id;
    ?>
" class="core-info ">
          <?php 
    echo html::clean($postage_band->name);
    ?>
  </td>
  <td>
    <?php 
    echo basket::formatMoney($postage_band->flat_rate);
    ?>
        </td>
  <td>
    <?php 
    echo basket::formatMoney($postage_band->per_item);
    ?>
  </td>
    <td class="gActions">
      <a href="<?php 
    echo url::site("admin/postage_bands/edit_postage_band_form/{$postage_band->id}");
    ?>
"
          open_text="<?php 
    echo t("close");
    ?>
"
          class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
          <span class="ui-icon ui-icon-pencil"></span><span class="gButtonText"><?php 
    echo t("edit");
    ?>
Exemple #18
0
 function validate_ipn($key)
 {
     // parse the paypal URL
     $url_parsed = parse_url($this->paypal_url);
     // generate the post string from the _POST vars aswell as load the
     // _POST vars into an arry so we can play with them from the calling
     // script.
     $post_string = 'cmd=_notify-validate';
     foreach ($_POST as $field => $value) {
         $this->ipn_data["{$field}"] = $value;
         $value = urlencode(stripslashes($value));
         $value = preg_replace('/(.*[^%^0^D])(%0A)(.*)/i', '${1}%0D%0A${3}', $value);
         $post_string .= '&' . $field . '=' . $value;
     }
     // open the connection to paypal
     $fp = fsockopen($this->secure_url, 443, $err_num, $err_str, 30);
     if (!$fp) {
         // could not open the connection.  If loggin is on, the error message
         // will be in the log.
         $this->last_error = "fsockopen error no. {$errnum}: {$errstr}";
         $this->log_ipn_results($key, false);
         return false;
     } else {
         // Post the data back to paypal
         fputs($fp, "POST " . $url_parsed['path'] . " HTTP/1.1\r\n");
         fputs($fp, "Host: " . $url_parsed['host'] . "\r\n");
         fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
         fputs($fp, "Content-length: " . strlen($post_string) . "\r\n\r\n");
         //fputs($fp, "Connection: close\r\n\r\n");
         fputs($fp, $post_string . "\r\n\r\n");
         // loop through the response from the server and append to variable
         while (!feof($fp)) {
             $this->ipn_response .= fgets($fp, 1024);
         }
         fclose($fp);
         // close connection
     }
     if (stristr($this->ipn_response, "VERIFIED") === false) {
         // Invalid IPN transaction.  Check the log for details.
         $this->last_error = 'IPN Validation Failed. ' . $url_parsed['host'] . '\\' . $url_parsed['path'];
         $this->log_ipn_results($key, false);
         return false;
     } else {
         // Valid IPN transaction.
         // check recievers e-mail
         $business = basket::getPaypalAccount();
         if ($this->ipn_data['receiver_email'] != $business) {
             $this->last_error = 'receivers e-mail did not match ' . $business;
             $this->log_ipn_results($key, false);
             return false;
         }
         // if confirmed check message has not been received already
         if ($this->ipn_data['payment_status'] == "Completed") {
             $message = ORM::factory("ipn_message")->where('key', "=", $key)->where('status', "=", 'completed')->where('txn_id', "=", $this->ipn_data['txn_id'])->find();
             if ($message->loaded()) {
                 $this->last_error = 'Message alread received.';
                 $this->log_ipn_results($key, false);
                 return false;
             }
         }
         $this->log_ipn_results($key, true);
         return true;
     }
 }
Exemple #19
0
 public function order($templ_name = 'order_steps')
 {
     $templ_file = '/eshop/' . $templ_name . '.tpl';
     $TEMPLATE = page::getTemplate($templ_file);
     if (!is_array($TEMPLATE)) {
         return page::errorNotFound('eshop.basket', $templ_file);
     }
     if (user::isGuest()) {
         page::assign('order.cost', basket::getTotalCost());
         return page::parse($TEMPLATE['no_auth']);
     }
     if (!isset($_SESSION['order_step'])) {
         $_SESSION['order_step'] = 1;
     }
     if (system::url(2) == 'back') {
         $_SESSION['order_step']--;
     }
     switch ($_SESSION['order_step']) {
         case 1:
             // Доставка
             $sel = new ormSelect('eshop_delivery_method');
             $sel->fields('name, price, notice');
             $list = '';
             while ($obj = $sel->getObject()) {
                 page::assign('obj.id', $obj->id);
                 page::assign('obj.name', $obj->name);
                 page::assign('obj.price', $obj->price);
                 page::assign('obj.notice', $obj->notice);
                 $act = isset($_SESSION['order']['delivery']) && $obj->id == $_SESSION['order']['delivery'] ? '_active' : '';
                 $list .= page::parse($TEMPLATE['delivery_list' . $act]);
             }
             page::assign('delivery_list', $list);
             page::assign('order.name', isset($_SESSION['order']['name']) ? $_SESSION['order']['name'] : user::get('name'));
             page::assign('order.surname', isset($_SESSION['order']['surname']) ? $_SESSION['order']['surname'] : user::get('surname'));
             page::assign('order.phone', isset($_SESSION['order']['phone']) ? $_SESSION['order']['phone'] : user::get('phone'));
             page::assign('order.address', isset($_SESSION['order']['address']) ? $_SESSION['order']['address'] : user::get('address'));
             page::assign('order.notice', isset($_SESSION['order']['notice']) ? $_SESSION['order']['notice'] : '');
             page::assign('order.cost', basket::getTotalCost());
             return page::parse($TEMPLATE['delivery']);
             break;
         case 2:
             // Подтверждение
             // Расчитываем общую стоимость с учетом доставки
             if ($delivery = ormObjects::get($_SESSION['order']['delivery'])) {
                 page::assign('order.delivery', $delivery->name);
                 page::assign('order.delivery_price', $delivery->price);
                 $cost = $delivery->price + basket::getTotalCost();
                 page::assign('order.cost', $cost);
             }
             page::assign('order.name', isset($_SESSION['order']['name']) ? $_SESSION['order']['name'] : user::get('name'));
             page::assign('order.surname', isset($_SESSION['order']['surname']) ? $_SESSION['order']['surname'] : user::get('surname'));
             page::assign('order.phone', isset($_SESSION['order']['phone']) ? $_SESSION['order']['phone'] : user::get('phone'));
             page::assign('order.address', isset($_SESSION['order']['address']) ? $_SESSION['order']['address'] : user::get('address'));
             return page::parse($TEMPLATE['aception']);
             break;
         default:
             unset($_SESSION['order_step']);
             system::redirect('/eshop/basket');
     }
 }
Exemple #20
0
 public function send_cancellation_confirmation($order)
 {
     // delivery cancelled mail to customer
     $to = $order->email;
     $from = "From: " . basket::getEmailAddress();
     $subject = basket::replaceStringsAll(basket::getOrderCancelledEmailSubject(), $order);
     $body = basket::getOrderCancelledEmail() . "\r\n" . basket::getOrderEmailClosing() . "";
     //replace variables
     $body = basket::replaceStringsAll($body, $order);
     //send mail
     mail($to, $subject, $body, $from);
 }
Exemple #21
0
 public function complete()
 {
     access::verify_csrf();
     $basket = Session_Basket::get();
     //$admin_address = basket::getEmailAddress();
     $admin_email = "Order for :\n" . $basket->name . "\n" . $basket->house . "\n" . $basket->street . "\n" . $basket->suburb . "\n" . $basket->town . "\n" . $basket->postcode . "\n" . $basket->email . "\n" . $basket->phone . "\nPlaced at " . date("d F Y - H:i", time()) . "\nTotal Owed " . $basket->cost() . " in " . basket::getCurrency() . "\n\nItems Ordered:\n\n";
     // create the order items
     foreach ($basket->contents as $basket_item) {
         $item = $basket_item->getItem();
         $prod = ORM::factory("product", $basket_item->product);
         $admin_email = $admin_email . "\n" . $item->title . " - " . $item->url() . "\n" . $prod->name . " - " . $prod->description . "\n" . $basket_item->quantity . " @ " . $prod->cost . "\n\n";
     }
     $from = "From: " . basket::getEmailAddress();
     mail(basket::getEmailAddress(), "Order from " . $basket->name, $admin_email, $from);
     $basket->clear();
     $template = new Theme_View("page.html", "basket");
     $view = new View("order_complete.html");
     $template->content = $view;
     print $template;
 }
Exemple #22
0
    $_total += $d_ord->kolvo * $d_ord->cost;
    ?>
					  
						
					<?php 
}
?>
					  
                    </table>
                    
					<br />
					
                    <div align="right">
                    	Промежуточный итог:	<?php 
echo basket::format_Cost($_total);
?>
 RUB <br />
                        Стоимость доставки: <?php 
echo basket::get_Cost_Deliver($obj->id_user, $_total);
?>
 RUB<br />
                        <strong>Итого:</strong> <?php 
echo basket::format_Cost($_total + basket::get_Cost_Deliver($obj->id_user, $_total));
?>
 RUB
                    </div>
					
				</div>				
					
					
Exemple #23
0
 private function _complete($order)
 {
     $template = new Theme_View("page.html", "basket");
     $view = new View("order_complete.html");
     $ordernumber = basket::getOrderPrefix() . $order->id;
     $view->ordernumber = $ordernumber;
     $view->order = $order;
     $view->webshop = basket::getWebshop();
     $view->email = basket::getEmailAddress();
     $template->content = $view;
     print $template;
 }
?>
"
          class="gButtonLink ui-state-default ui-corner-all ui-icon-left">
            <span class="ui-icon ui-icon-trash"></span><?php 
echo t("Remove");
?>
</a>
      </td>
  </tr>
      <? endforeach ?>
      <tr id="" class="<?php 
echo text::alternate("gOddRow", "gEvenRow");
?>
">
        <td></td><td></td><td>Total Cost</td><td><?php 
echo basket::formatMoney($total);
?>
</td><td></td>
      </tr>

   </table>
      <? else: ?>
      Shopping Basket is Empty
      <? endif; ?>

  </div>

  <? if (isset($basket->contents ) && count($basket->contents) > 0): ?>

  <? if (basket::isPaypal()): ?>
  <a href="javascript:co();"
Exemple #25
0
    // парсим данные
    $message = parsing_data($mass_element_for_parsing, $mass_result_for_parsing, nl2br($_arr['text']));
    // парсим заголовок письма
    $subject = replace_data($_arr['zag'], '%site%', ADRESS_SITE);
    $subject = replace_data($subject, '%number_order%', '' . $_number_order);
    // отправляем мыло
    sent_email_new($_user->email, $message, "", $subject, $GLOBALS["mailadmin"]);
    //---------------------------------------------------------//
    //---------------------------------------------------------//
    //---------------------------------------------------------//
    // очищаем корзину
    basket::clear_Basket();
    $_str .= v::getI18n('message_after_oformleniya_basket');
    echo "<meta http-equiv='refresh' content='5;URL=/index.php'>";
} else {
    // выводим содержимое корзины
    if (basket::show_Basket()) {
        $_str .= system::show_tpl(array('result' => basket::show_Basket()), 'frontend/basket/list.php');
        if (basket::show_Basket()) {
            if (!registration::is_Autorize()) {
                // новый пользователь
                $_str .= system::show_tpl(array('city' => dbh::get_city()), '/frontend/basket/new_user.php');
            } else {
                //авторизованный пользователь
                $_str .= system::show_tpl(array(), '/frontend/basket/autorize_user.php');
            }
        }
    } else {
        $_str .= 'Товары в корзине отсутствуют!';
    }
}
    ?>
" class="<?php 
    echo text::alternate("gOddRow", "gEvenRow");
    ?>
">
        <td id="product-<?php 
    echo $product->id;
    ?>
" class="core-info ">
          <?php 
    echo html::clean($product->name);
    ?>
  </td>
  <td>
    <?php 
    echo basket::formatMoneyForWeb($product->cost);
    ?>
        </td>
  <td>
    <?php 
    echo html::clean($product->description);
    ?>
  </td>
  <td>
    <?php 
    echo html::clean($product->postage_band->name);
    ?>
  </td>


    <td class="g-actions">
Exemple #27
0
 static function getProductArray($id)
 {
     $producta = array();
     // check for product override
     $product_override = ORM::factory("product_override")->where('item_id', "=", $id)->find();
     if (!$product_override->loaded()) {
         // no override found so check parents
         // check parents for product override
         $item = ORM::factory("item", $id);
         $parents = $item->parents();
         foreach ($parents as $parent) {
             // check for product override
             $product_override = ORM::factory("product_override")->where('item_id', "=", $parent->id)->find();
             if ($product_override->loaded()) {
                 break;
             }
         }
     }
     $products = ORM::factory("product")->find_all();
     foreach ($products as $product) {
         $show = true;
         $cost = $product->cost;
         if ($product_override->loaded()) {
             $show = !$product_override->none;
             $item_product = ORM::factory("item_product")->where('product_override_id', "=", $product_override->id)->where('product_id', "=", $product->id)->find();
             if ($item_product->loaded()) {
                 $cost = $item_product->cost;
                 if (!$show) {
                     $show = $item_product->include;
                 }
             }
         }
         if ($show) {
             $producta[$product->id] = $product->description . " (" . basket::formatMoney($cost) . ")";
         }
     }
     return $producta;
 }
Exemple #28
0
<?php

include_once "modules/foodcenter/class_basket.php";
include_once "modules/foodcenter/class_product.php";
$basket = new basket();
$basket->add_to_basket_from_global();
//Get Barcode if exists and translate to userid
if ($_POST['barcodefield']) {
    $row = $db->qry_first('SELECT userid FROM %prefix%user WHERE barcode = %string%', $_POST["barcodefield"]);
    $_GET['userid'] = $row['userid'];
}
if (isset($_GET['userid'])) {
    $_SESSION['foodcenter']['theke_userid'] = $_GET['userid'];
}
if ($_GET['step'] == "del") {
    unset($_SESSION['foodcenter']['theke_userid']);
    unset($_SESSION['basket_item']['product']);
}
if (!isset($_SESSION['foodcenter']['theke_userid'])) {
    if ($cfg['sys_barcode_on']) {
        $dsp->AddBarcodeForm("<strong>" . t('Strichcode') . "</strong>", "", "index.php?mod=foodcenter&action=theke&userid=");
    }
    if (!isset($_POST['search_dd_input'][2])) {
        $_POST['search_dd_input'][2] = ">1";
    }
    if (!isset($_POST['search_dd_input'][3])) {
        $_POST['search_dd_input'][3] = "0";
    }
    $current_url = 'index.php?mod=foodcenter&action=theke';
    $target_url = 'index.php?mod=foodcenter&action=theke&userid=';
    include_once 'modules/foodcenter/search.inc.php';
Exemple #29
0
 public function title()
 {
     return basket::getOrderPrefix() . $this->id . " " . $this->name . " " . $this->status();
 }
        <td></td><td></td><td>Total Cost</td><td><?php 
echo html::clean(basket::formatMoney($total + $postage));
?>
</td><td></td>
      </tr>

   </table>
      <? else: ?>
      Shopping Basket is Empty
      <? endif; ?>

  </div>

  <? if (isset($basket->contents ) && count($basket->contents) > 0): ?>

  <? if (basket::isPaypal()): ?>
  <a href="javascript:co();"
    class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
      <span class="ui-icon ui-icon-arrow-1-e"></span><?php 
echo t("Pay with Credit Card or Paypal");
?>
</a>
  <a href="<?php 
echo url::site("basket/checkout");
?>
"
    class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
      <span class="ui-icon ui-icon-arrow-1-e"></span><?php 
echo t("Pay off line");
?>
</a>