Jump to content

Get Manufacturer detail by id?


ballot

Recommended Posts

static public function getManufacturers($getNbProducts = false, $id_lang = 0, $active = false, $p = false, $n = false)



this function returns all manufacturers i need just 1 manufacturer detail that i know id of it is there a function/class or i cant see :/

Link to comment
Share on other sites

in supplier.php

if ($id = intval(Tools::getValue('id_'.$objectType)))
{
   include(dirname(__FILE__).'/product-sort.php');

   $object = new $className(intval($id), $cookie->id_lang);
   if (!Validate::isLoadedObject($object))
       $errors[] = Tools::displayError('object does not exist');
   else
   {
       /* rewrited url set */
       if ($objectType == 'supplier')
           $rewrited_url = $link->getSupplierLink($object->id, $object->link_rewrite);
       elseif ($objectType == 'manufacturer')
           $rewrited_url = $link->getManufacturerLink($object->id, $object->link_rewrite);
       include(dirname(__FILE__).'/header.php');

       $nbProducts = $object->getProducts($id, NULL, NULL, NULL, $orderBy, $orderWay, true);
       //$databok = call_user_func(array($className, 'get'.$className.'s'), false, intval($cookie->id_lang), true);
       include(dirname(__FILE__).'/pagination.php');
       $smarty->assign(array(
           'nb_products' => $nbProducts,
           'products' => $object->getProducts($id, intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay),
           $objectType => $object));
   }

   $smarty->assign(array(
       'errors' => $errors,
       'path' => Tools::safeOutput($object->name),
       'id_lang' => intval($cookie->id_lang),
   ));
   $smarty->display(_PS_THEME_DIR_.$objectType.'.tpl');

}




in manufacturer.tpl

{include file=$tpl_dir./breadcrumb.tpl}

{l s='List of products by manufacturer:'} {$manufacturer->name|escape:'htmlall':'UTF-8'}



manufacturer.tpl used a variable as named as $manufacturer but i cant see it as defined in supplier.php :( ?

Link to comment
Share on other sites

  • 10 months later...
  • 2 years later...

Just use:

 

$manufacturer = new Manufacturer($id_manufacturer, $id_lang);

Then you can access a variable like this:

 

$manufacturer->name

 

hi rocky,

 

I want to use this but how can I get its parameters e.g. $id_manufacturer?

 

Thanks for your time! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...