public static function retrieveInventoryForProduct($db, $table, $product_id) { $select = $db->select(); $select->from($table, '*')->where('product_id = ?', $product_id); $records = $db->fetchAll($select); $id = array(); $inventoryArray = array(); foreach ($records as $k => $v) { $inventoryDetail['basic'] = $v; $inventoryDetail['profile'] = self::loadInventoryProfileDetail($db, 'product_inventory_profile', $v['product_inventory_id']); $inventoryDetail['profileCount'] = count($inventoryDetail['profile']); $inventoryDetail['images'] = DatabaseObject_Helper_ImageUpload::loadImagesForItem($db, 'product_inventory_images', $v['product_inventory_id']); $inventoryArray[] = $inventoryDetail; } //return $id; return $inventoryArray; }
public function retrieveProductFromProductsForPurchaseDetails($db, $productID) { //Fetch product $productProfileQuery = $db->select(); $productProfileQuery->from(array('p' => 'products'), '*')->where('product_id = ?', $productID); $productProfileQuery->join(array('u' => 'users'), 'u.userID=p.uploader_id', array('u.first_name', 'u.last_name')); $product = $db->fetchAll($productProfileQuery); if (count($product) == '1') { //Fetch description $productProfileQuery = $db->select(); $productProfileQuery->from('product_profiles', '*')->where('Product_id = ?', $product[0]['product_id']); $product['profile'] = $db->fetchAll($productProfileQuery); //Fetch product images $productImageQuery = $db->select(); $productImageQuery->from(array('images' => 'product_images'), '*')->where('images.Product_id = ?', $product[0]['product_id']); //echo $select2; $product['images'] = $db->fetchAll($productImageQuery); //Fetch general inventory information $inventorySelect = $db->select(); $inventorySelect->from(array('i' => 'product_inventories'), '*')->where('i.product_id = ?', $productID); $product['inventory'] = $db->fetchAll($inventorySelect); foreach ($product['inventory'] as $k => $v) { //Fetch inventory profile details $inventoryProfileQuery = $db->select(); $inventoryProfileQuery->from('product_inventory_profile', '*')->where('product_inventory_profile_id =?', $v['product_inventory_id']); $product['inventory'][$k]['profile'] = $db->fetchAll($inventoryProfileQuery); $product['inventory'][$k]['images'] = DatabaseObject_Helper_ImageUpload::loadImagesForItem($db, 'product_inventory_images', $v['product_inventory_id']); } $product['existingFabricSet'] = DatabaseObject_Helper_ManageAttribute::retrieveAttributeForProduct($db, 'fabric_set', $product[0]['product_id']); //Zend_Debug::dump($fp->existingFabricSet); $product['existingAttributeSet'] = DatabaseObject_Helper_ManageAttribute::retrieveAttributeForProduct($db, 'custom_attribute', $product[0]['product_id']); $product['systemColorAndShoesAttributes'] = DatabaseObject_Helper_ManageAttribute::retrieveProductColorAndShoeAttribute($db, $product[0]['inventory_attribute_table'], $product[0]['product_id']); } return $product; }