Exemplo n.º 1
0
        ?>
                                        </div>

                                        <?php 
        if (!$data['isDownloadable']) {
            ?>
                                            <div id="shipping_info_<?php 
            echo $data['orderID'];
            ?>
"
                                                class="row-shipping-info">
                                                <strong>Their Shipping Information:</strong>

                                                <div>
                                                    <?php 
            $countryData = BuckysCountry::getCountryById($data['countryID']);
            $shippingAddressVal = '<div>' . $data['fullName'] . '</div>' . '<div>' . $data['address'] . '</div>' . '<div>' . $data['address2'] . '</div>' . '<div>' . $data['city'] . ', ' . $data['state'] . '</div>' . '<div>' . $data['zip'] . '</div>' . '<div>' . $countryData["country_title"] . '</div>';
            ?>

                                                    <?php 
            echo $shippingAddressVal;
            ?>
                                                </div>
                                            </div>
                                        <?php 
        }
        ?>
                                    </div>
                                    <div class="clear"></div>
                                </td>
                                <td class="n2">
 /**
  * Search items
  * 
  * @param string $qStr : Query String
  * @param string $catStr : Category Name/ Category ID
  * @param string $locStr : Location / Location ID
  * @return array
  */
 public function search($qStr, $catStr, $locStr, $userID)
 {
     global $db;
     $tradeCatIns = new BuckysTradeCategory();
     $tradeLocationIns = new BuckysCountry();
     //Get category data
     $catData = null;
     if (is_numeric($catStr)) {
         $catData = $tradeCatIns->getCategoryByID($catStr);
     } else {
         $catData = $tradeCatIns->getCategoryByName($catStr);
     }
     //Get Location data
     $locationData = null;
     if (is_numeric($locStr)) {
         $locationData = $tradeLocationIns->getCountryById($locStr);
     } else {
         $locationData = $tradeLocationIns->getCountryByName($locStr);
     }
     //Make Where condition
     $whereCondList = array();
     if (isset($qStr) && $qStr != '') {
         $qStr = addslashes($qStr);
         $whereCondList[] = sprintf(" MATCH (i.title, i.subtitle, i.description) AGAINST ('%s' IN BOOLEAN MODE)", $qStr);
     }
     if (isset($catData)) {
         $whereCondList[] = 'i.catID=' . $catData['catID'];
     } else {
         if ($catStr != '') {
             return null;
         }
     }
     if (isset($locationData)) {
         $whereCondList[] = 'i.locationID=' . $locationData['countryID'];
     }
     if (isset($userID) && is_numeric($userID)) {
         $whereCondList[] = 'i.userID=' . $userID;
     }
     //Valid items
     $avaiableTime = date('Y-m-d H:i:s', time() - TRADE_ITEM_LIFETIME * 3600 * 24);
     $whereCondList[] = "i.createdDate >='" . $avaiableTime . "'";
     $whereCondList[] = 'i.status=' . BuckysTradeItem::STATUS_ITEM_ACTIVE;
     $whereCond = ' WHERE ' . implode(' AND ', $whereCondList);
     $whereCond .= ' GROUP BY i.itemID ';
     $query = sprintf("SELECT i.*, (SELECT COUNT(*) FROM %s AS o WHERE i.itemID=o.targetItemID AND o.status=%d) AS offer, u.firstName, u.lastName, tu.totalRating, tu.positiveRating \n                            FROM %s AS i \n                            LEFT JOIN %s AS tu ON i.userID=tu.userID \n                            LEFT JOIN %s AS u ON i.userID=u.userID \n                            ", TABLE_TRADE_OFFERS, BuckysTradeOffer::STATUS_OFFER_ACTIVE, TABLE_TRADE_ITEMS, TABLE_TRADE_USERS, TABLE_USERS);
     $query = $db->prepare($query . $whereCond);
     $data = $db->getResultsArray($query);
     return $data;
 }
 /**
  * Search products
  *
  * @param string $qStr   : Query String
  * @param string $catStr : Category Name/ Category ID
  * @param string $locStr : Location / Location ID
  * @return array
  */
 public function search($qStr, $catStr, $locStr, $userID)
 {
     global $db;
     $catIns = new BuckysShopCategory();
     $locationIns = new BuckysCountry();
     //Get category data
     $catData = null;
     if (is_numeric($catStr)) {
         $catData = $catIns->getCategoryByID($catStr);
     } else {
         $catData = $catIns->getCategoryByName($catStr);
     }
     //Get Location data
     $locationData = null;
     if (is_numeric($locStr)) {
         $locationData = $locationIns->getCountryById($locStr);
     } else {
         $locationData = $locationIns->getCountryByName($locStr);
     }
     //Make Where condition
     $whereCondList = [];
     if (isset($qStr) && $qStr != '') {
         $qStr = addslashes($qStr);
         $whereCondList[] = sprintf(" MATCH (p.title, p.subtitle, p.description) AGAINST ('%s' IN BOOLEAN MODE)", $qStr);
     }
     if (isset($catData)) {
         $whereCondList[] = 'p.catID=' . $catData['catID'];
     } else {
         if ($catStr != '') {
             return null;
         }
     }
     if (isset($locationData)) {
         $whereCondList[] = 'p.locationID=' . $locationData['countryID'];
     }
     if (isset($userID) && is_numeric($userID)) {
         $whereCondList[] = 'p.userID=' . $userID;
     }
     //Valid items
     $avaiableTime = date('Y-m-d H:i:s');
     $whereCondList[] = " (p.expiryDate >='" . $avaiableTime . "' OR p.listingDuration=-1) ";
     $whereCondList[] = 'p.status=' . BuckysShopProduct::STATUS_ACTIVE;
     $whereCond = ' WHERE ' . implode(' AND ', $whereCondList);
     $whereCond .= ' GROUP BY p.productID ';
     $query = sprintf("SELECT p.*, u.firstName, u.lastName, tu.totalRating, tu.positiveRating \n                            FROM %s AS p \n                            LEFT JOIN %s AS tu ON p.userID=tu.userID \n                            LEFT JOIN %s AS u ON p.userID=u.userID \n                            ", TABLE_SHOP_PRODUCTS, TABLE_USERS_RATING, TABLE_USERS);
     $query = $db->prepare($query . $whereCond);
     $data = $db->getResultsArray($query);
     return $data;
 }
Exemplo n.º 4
0
$userIns = new BuckysUser();
$tradeOfferIns = new BuckysTradeOffer();
$view['item'] = $tradeItemIns->getItemById($paramItemID);
$view['myID'] = $userID;
if (!isset($view['item']) || $view['item']['status'] == BuckysTradeItem::STATUS_ITEM_INACTIVE) {
    buckys_redirect('/trade/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Check if the items owner is active one
$userData = $userIns->getUserData($view['item']['userID']);
if ($userData['status'] == BuckysUser::STATUS_USER_BANNED) {
    buckys_redirect('/trade/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Read more info from DB
$catData = $tradeCatIns->getCategoryByID($view['item']['catID']);
$view['item']['categoryName'] = isset($catData) ? $catData['name'] : '';
$countryData = $countryIns->getCountryById($view['item']['locationID']);
$view['item']['locationName'] = isset($countryData) ? $countryData['country_title'] : '';
$view['item']['userInfo'] = $userIns->getUserBasicInfo($view['item']['userID']);
if (!isset($view['item']['userInfo'])) {
    buckys_redirect('/trade/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Check if you can make an offer to this user. If this user decline your offer before for this item, then you can't send again
$view['offerDisabled'] = false;
if (!$userID || $userID == $view['item']['userID']) {
    $view['offerDisabled'] = true;
} else {
    /**
     * If it has been set, then it means you can't make an offer if one of your offer declined by this user.
     * When you enable this block, please note BuckysTradeOffer::addOffer() function, there are parts disabled
     */
    //$view['offerDisabled'] = $tradeOfferIns->checkDeclinedOffer($view['item']['itemID'], null, $userID);
Exemplo n.º 5
0
$userIns = new BuckysUser();
$shippingInfoIns = new BuckysTradeUser();
$view['product'] = $shopProductIns->getProductById($paramShopID);
$view['myID'] = $userID;
if (!isset($view['product']) || $view['product']['status'] == BuckysShopProduct::STATUS_INACTIVE) {
    buckys_redirect('/shop/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Check if the items owner is active one
$userData = $userIns->getUserData($view['product']['userID']);
if ($userData['status'] == BuckysUser::STATUS_USER_BANNED) {
    buckys_redirect('/shop/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
//Read more info from DB
$catData = $catIns->getCategoryByID($view['product']['catID']);
$view['product']['categoryName'] = isset($catData) ? $catData['name'] : '';
$countryData = $countryIns->getCountryById($view['product']['locationID']);
$view['product']['locationName'] = isset($countryData) ? $countryData['country_title'] : '';
$view['product']['userInfo'] = $userIns->getUserBasicInfo($view['product']['userID']);
if (!isset($view['product']['userInfo'])) {
    buckys_redirect('/shop/index.php', MSG_INVALID_REQUEST, MSG_TYPE_ERROR);
}
$view['my_product_flag'] = false;
$view['available_shipping_price'] = null;
$view['my_shipping_info'] = $myShippingData = $shippingInfoIns->getUserByID($userID);
$view['fill_shipping_info'] = false;
$view['my_info'] = $userIns->getUserBasicInfo($userID);
$view['is_purchased'] = $shopProductIns->isPurchased($userID, $paramShopID);
if (!$userID || $userID == $view['product']['userID']) {
    $view['my_product_flag'] = true;
} else {
    if ($view['product']['isDownloadable'] == 1) {
Exemplo n.º 6
0
/**
* Get country by ID
* 
* @param integer $countryID
*/
function buckys_trade_get_country_name($countryID)
{
    $countryIns = new BuckysCountry();
    $countryData = $countryIns->getCountryById($countryID);
    if ($countryData) {
        return $countryData['country_title'];
    }
    return;
}
Exemplo n.º 7
0
                            <?php 
        echo $view['my_info']['firstName'] . ' ' . $view['my_info']['lastName'] . "<br/>";
        if ($view['my_shipping_info']['shippingAddress'] != '') {
            echo $view['my_shipping_info']['shippingAddress'] . ' ' . $view['my_shipping_info']['shippingAddress2'] . "<br/>";
        }
        if ($view['my_shipping_info']['shippingCity'] != '') {
            echo $view['my_shipping_info']['shippingCity'] . ", ";
        }
        if ($view['my_shipping_info']['shippingState'] != '') {
            echo $view['my_shipping_info']['shippingState'] . "<br/>";
        }
        if ($view['my_shipping_info']['shippingZip'] != '') {
            echo $view['my_shipping_info']['shippingZip'] . "<br/>";
        }
        if ($view['my_shipping_info']['shippingCountryID'] != '') {
            $cotD = BuckysCountry::getCountryById($view['my_shipping_info']['shippingCountryID']);
            echo $cotD['country_title'];
        }
        ?>
                        </p>

                        <label>Returns:</label>
                        <p>
                            <?php 
        echo $productData['returnPolicy'];
        ?>
                        </p>

                        <label>Item:</label>
                        <div class="clear"></div>
                        <div class="prod-l">