|
Shop_Manufacturer class
Represents a product manufacturer.
This class has fields and methods for accessing a manufacturer name, address and contact information.
Objects of this class are accessible through the manufacturer field of the Shop_Product class.
You can use the following code for displaying a list of manufacturers on a page: <? $manufacturers = Shop_Manufacturer::create()->order('name')->find_all(); ?> <ul> <? foreach ($manufacturers as $manufacturer): ?> <li><?= h($manufacturer->name) ?></li> <? endforeach ?> </ul> See AlsoPublic propertiesShow inherited properties.
Public methodsShow inherited methods.
Events
Property details¶ address propertypublic string $address;
Specifies the manufacturer address.
¶ city propertypublic string $city;
Specifies the manufacturer city.
¶ country propertypublic Shop_Country $country;
Specifies the manufacturer country.
¶ description propertypublic string $description;
Specifies the manufacturer description.
¶ email propertypublic string $email;
Specifies the manufacturer email address.
¶ fax propertypublic string $fax;
Specifies the manufacturer fax number.
¶ id propertypublic integer $id;
Specifies the manufacturer record identifier.
¶ is_disabled propertypublic boolean $is_disabled;
Determines whether the manufacturer is disabled. Disabled manufacturers are not displayed by the shop:manufacturers and shop:manufacturer CMS actions.
¶ logo propertypublic Db_DataCollection $logo;
A collection of the manufacturer logo images. The collection always contains zero or one element - an object of Db_File class. See logo_url() method.
¶ name propertypublic string $name;
Specifies the manufacturer name.
¶ phone propertypublic string $phone;
Specifies the manufacturer phone number.
¶ state propertypublic Shop_CountryState $state;
Specifies the manufacturer country state.
¶ url propertypublic string $url;
Specifies the manufacturer website URL.
¶ url_name propertypublic string $url_name;
Specifies the manufacturer URL name.
¶ zip propertypublic string $zip;
Specifies the manufacturer ZIP/postal code.
Method details¶ list_categories() methodpublic Db_DataCollection list_categories(array $options=array())
Returns a list of product categories the manufacturer products belong to.
You can pass an array of options to the method. The only supported option is sorting
The supported fields you can sort the categories by are:
$categories = $manufacturer->list_categories(array( 'sorting'=>array('name', 'code') ));
You can add desc suffix to the sort field name to enable the descending sorting: $categories = $manufacturer->list_categories(array( 'sorting'=>array('name desc') )); ¶ list_products() methodpublic Shop_Product list_products(array $options=array())
Returns a list of the manufacturer products.
The result of this function is an object of the Shop_Product class. To obtain a collection of all
manufacturer products call the find_all() methods of the method result.
$full_product_list = $manufacturer->list_products()->find_all(); $product_list = $manufacturer->list_products(array( 'sorting'=>array('price', 'name') ))
$product_list = $manufacturer->list_products(array( 'sorting'=>array('price desc') )) ¶ logo_url() methodpublic string logo_url(mixed $width, mixed $height, boolean $as_jpeg=true, array $params=array( 'mode'=>'keep_ratio'))
Returns an URL of the manufacturer logo image thumbnail.
The method returns NULL if the logo was not uploaded. Use this method for displaying a manufacturer logo.
You can use exact integer values for the $width and $height parameters, or word 'auto' for automatic image scaling.
The $as_jpeg parameter allows you to generate PNG images with transparency support.
By default the parameter value is TRUE and the method generates a JPEG image. Pass the FALSE value to the parameter to generate a PNG image.
The $params array allows to pass parameters to image processing modules (which handle the core:onProcessImage event).
The following line of code outputs a thumbnail of the manufacturer logo. The thumbnail width is 100 pixels,
and thumbnail height is calculated by LemonStand to keep the original aspect ratio.
<img src="<?= h($product->manufacturer->logo_url(100, 'auto')) ?>"/> See Also |