/**
  * Retourne la liste des Fournisseurs non liés au produit sous la forme d'un combo
  *
  */
 public function getNonLinkedSuppliersAsCombo($name = 'supplier')
 {
     $collection = mage::GetModel('Purchase/ProductSupplier')->getCollection()->addFieldToFilter('pps_product_id', $this->_product_id);
     $t_ids = array();
     $t_ids[] = -1;
     foreach ($collection as $item) {
         $t_ids[] = $item->getpps_supplier_num();
     }
     //Recupere la liste
     $collection = mage::GetModel('Purchase/Supplier')->getCollection()->addFieldToFilter('sup_id', array('nin' => $t_ids));
     //transforme en combo
     $retour = '<select id="' . $name . '" name="' . $name . '">';
     foreach ($collection as $item) {
         $retour .= '<option value="' . $item->getId() . '">' . $item->getsup_name() . '</option>';
     }
     $retour .= '</select>';
     //retour
     return $retour;
 }
Beispiel #2
0
 /**
  * Retourne la liste des produits liés au fabricant
  *
  */
 public function getProducts()
 {
     $collection = mage::GetModel('Purchase/ProductManufacturer')->getCollection()->join('Catalog/Product', 'ppm_product_id=entity_id')->addFieldToFilter('ppm_manufacturer_num', $this->getManufacturer()->getId());
     return $collection;
 }
 /**
  * Retourne en ajax les informations sur l'association entre un produit et un supplier
  *
  */
 public function GetSupplierInformationAction()
 {
     //recupere l'objet
     $object = mage::GetModel('Purchase/ProductSupplier')->load($this->getRequest()->getParam('pps_id'));
     //retourne en ajax
     $this->getResponse()->setHeader('Content-type', 'application/x-json');
     $this->getResponse()->setBody($object->toJson());
 }
 /**
  * Supprime un contact
  *
  */
 public function DeleteContactAction()
 {
     //recupere l'objet
     $object = mage::GetModel('Purchase/Contact')->load($this->getRequest()->getParam('pc_num'))->delete();
 }