function getProductObject($pProductsMixed) { $productsId = zen_get_prid($pProductsMixed); if (BitBase::verifyId($productsId)) { if (!isset($this->mProductObjects[$productsId])) { if ($this->mProductObjects[$productsId] = bc_get_commerce_product($productsId)) { $ret =& $this->mProductObjects[$productsId]; } } } return $this->mProductObjects[$productsId]; }
function bitcommerce_content_expunge(&$pObject) { require_once BITCOMMERCE_PKG_PATH . 'includes/bitcommerce_start_inc.php'; if ($relProduct = bc_get_commerce_product(array('related_content_id' => $pObject->mContentId))) { // do not delete products if related content is getting deleted, but product has been purchased if ($relProduct->isPurchased()) { $relProduct->update(array('related_content_id' => NULL)); } else { $relProduct->expunge(); } } }
function zen_update_lowest_purchase_price($product_id) { if ($product = bc_get_commerce_product(array('products_id' => $_REQUEST['products_id']))) { $product->getLowestPrice(); } }
switch ($action) { case 'setflag': if ($_GET['flag'] == '0' || $_GET['flag'] == '1') { if (isset($_GET['pID'])) { zen_set_product_status($_GET['pID'], $_GET['flag']); } } zen_redirect(zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''))); break; case 'delete_product_confirm': if (file_exists(DIR_WS_MODULES . $zc_products->get_handler($product_type) . '/delete_product_confirm.php')) { require DIR_WS_MODULES . $zc_products->get_handler($product_type) . '/delete_product_confirm.php'; } else { if (!empty($_POST['products_id'])) { $product_categories = $_POST['product_categories']; if ($product = bc_get_commerce_product($_POST['products_id'])) { $product->expunge(); } zen_redirect(zen_href_link_admin(FILENAME_CATEGORIES, 'cPath=' . $cPath)); } } break; case 'move_product_confirm': if (file_exists(DIR_WS_MODULES . $zc_products->get_handler($product_type) . '/move_product_confirm.php')) { require DIR_WS_MODULES . $zc_products->get_handler($product_type) . '/move_product_confirm.php'; } else { require DIR_WS_MODULES . 'move_product_confirm.php'; } break; case 'insert_product_meta_tags': case 'update_product_meta_tags':
// split to add manufacturers_name to the display if (isset($_REQUEST['manufacturers_id'])) { $manufacturers_query = "SELECT `manufacturers_name`\n FROM " . TABLE_MANUFACTURERS . "\n WHERE `manufacturers_id` = '" . (int) $_REQUEST['manufacturers_id'] . "'"; $manufacturers = $gBitDb->Execute($manufacturers_query); if ($manufacturers->RecordCount() > 0) { $breadcrumb->add($manufacturers->fields['manufacturers_name'], zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $_REQUEST['manufacturers_id'])); } } // create the global product. products_id can be an array, such as in removing from cart if (isset($_REQUEST['products_id'])) { // clean products id to by signed 4 byte integer regardless of what kind of crap comes in $_GET['products_id'] = $_REQUEST['products_id'] = (int) $_REQUEST['products_id'] & 0x1fffffff; if (!empty($_POST['products_id'])) { $_POST['products_id'] = $_GET['products_id']; } $gBitProduct = bc_get_commerce_product(array('products_id' => $_REQUEST['products_id'])); if ($gBitProduct->isValid()) { if (empty($_REQUEST['cPath']) && !empty($gBitProduct->mInfo['master_categories_id'])) { $_REQUEST['cPath'] = $gBitProduct->mInfo['master_categories_id']; } } else { global $gBitSystem; $gBitSystem->setHttpStatus(HttpStatusCodes::HTTP_NOT_FOUND); unset($gBitProduct); } } if (empty($gBitProduct) && class_exists('CommerceProduct')) { $gBitProduct = new CommerceProduct(); } if (empty($_REQUEST['cPath'])) { $_REQUEST['cPath'] = '';
public static function getNewObject($pClass, $pContentId, $pLoadFromCache = TRUE) { return bc_get_commerce_product(array('content_id' => $pContentId)); }