Example #1
0
<?php

if (!defined('FLUX_ROOT')) {
    exit;
}
$this->loginRequired();
$title = 'Modificar Item da Loja';
require_once 'Flux/TemporaryTable.php';
require_once 'Flux/ItemShop.php';
$stackable = false;
$shopItemID = $params->get('id');
$shop = new Flux_ItemShop($server);
$categories = Flux::config('ShopCategories')->toArray();
$item = $shop->getItem($shopItemID);
if ($item) {
    $fromTables = array("{$server->charMapDatabase}.item_db", "{$server->charMapDatabase}.item_db2");
    $tableName = "{$server->charMapDatabase}.items";
    $tempTable = new Flux_TemporaryTable($server->connection, $tableName, $fromTables);
    $shopTable = Flux::config('FluxTables.ItemShopTable');
    $col = "id AS item_id, name_japanese AS item_name, type";
    $sql = "SELECT {$col} FROM {$tableName} WHERE items.id = ?";
    $sth = $server->connection->getStatement($sql);
    $sth->execute(array($item->shop_item_nameid));
    $originalItem = $sth->fetch();
    if ($originalItem && Flux::isStackableItemType($originalItem->type)) {
        $stackable = true;
    }
    if (count($_POST)) {
        $maxCost = (int) Flux::config('ItemShopMaxCost');
        $maxQty = (int) Flux::config('ItemShopMaxQuantity');
        $category = $params->get('category');
Example #2
0
<?php

if (!defined('FLUX_ROOT')) {
    exit;
}
$this->loginRequired('Please log-in to add items to your cart.');
require_once 'Flux/ItemShop.php';
$id = $params->get('id');
$shop = new Flux_ItemShop($server);
$item = $shop->getItem($id);
if ($item) {
    $server->cart->add($item);
    $session->setMessageData("{$item->shop_item_name} has been added to your cart.");
} else {
    $session->setMessageData("Couldn't add item to your cart.");
}
$action = $params->get('cart') ? 'cart' : 'index';
$this->redirect($this->url('purchase', $action));