/** * Loads the product from the DB, incuding product variation info * @param int $id MoodecProduct id * @return [type] [description] */ public function load($id) { global $DB; parent::load($id); $productVariations = $DB->get_records('local_moodec_variation', array('product_id' => $id)); if (!!$productVariations) { foreach ($productVariations as $pv) { $variationid = (int) $pv->id; $this->_variations[$variationid] = new MoodecProductVariation($variationid, true); } } else { throw new Exception('Unable to load product variation information using identifier: ' . $id); } }
/** * Loads the product from the DB, incuding simple product info * @param int $id MoodecProduct id * @return [type] [description] */ public function load($id) { parent::load($id); $this->_simpleVariation = new MoodecProductVariation($id); }