Hello dear experts! My witchcraft begins for OpenCards 2 and now with this code in the model:
public function getVendorProduct ($vendor_id) { $query = $this->db->query("select vproduct_id from ".DB_PREFIX."vendor where vendor = ".$vendor_id); //$query = $this->db->query("select vendor, product_id, image, price, name from ".DB_RPEFIX."vendor, ".DB_PREFIX."product, ".DB_PREFIX."product_description where ".DB_RPEFIX."vendor.vendor = ".$vendor_id." and ".DB_RPEFIX."product_description.product_id = ".$qqqqq." and ".DB_PREFIX."product.product_id = ".$qqqqq); if ($query) { $count_id = count($query); $vproducts = array(); for ($i=0; $i<$count_id; $i++) { $sql_products_data = $this->db->query("select product_id, image, price, name from ".DB_PREFIX."product, ".DB_PREFIX."product_description where ".DB_PREFIX."product_description.product_id = ".$query['vproduct_id']." and ".DB_PREFIX."product.product_id = ".$query['vproduct_id']); } foreach($sql_products_data as $result) { $vproducts['prod_id'] = $result['product_id']; $vproducts['prod_image'] = $result['image']; $vproducts['prod_price'] = $result['price']; $vproducts['prod_name'] = $result['name']; } return $vproducts; } }
Next, the controller:
$vendor_product = $this->model_catalog_vendor->getVendorProduct($vendor_id); $data['products_list_vendor'][] = array(); if($vendor_producys) { foreach ($vendor_products as $result) { $data['products_list_vendor']['vproduct_id'] = $result['prod_id']; $data['products_list_vendor']['vproduct_image'] = $result['prod_image']; $data['products_list_vendor']['vproduct_price'] = $result['prod_price']; $data['products_list_vendor']['vproduct_name'] = $result['prod_name']; } }
And finally, the very output to the store page:
<div id="vendor_products"> <?php forech ($products_list_vendor as $products_list) { ?> <p><?php echo $products_list['vproduct_id']; ?></p> <p>- - - - - - - - - -</p> <?php } ?> </div>
With such a spell, I only get 500 error so far, how to fix the code? Yuzal, did not find the answer
if($vendor_producys) {
is this a typo in the controller? - Andrew Hobbit