Product::attributeLabels PHP Метод

attributeLabels() публичный Метод

public attributeLabels ( ) : array
Результат array customized attribute labels (name=>label)
    public function attributeLabels()
    {
        return ['id' => Yii::t('StoreModule.store', 'ID'), 'category_id' => Yii::t('StoreModule.store', 'Category'), 'type_id' => Yii::t('StoreModule.store', 'Type'), 'name' => Yii::t('StoreModule.store', 'Title'), 'price' => Yii::t('StoreModule.store', 'Price'), 'discount_price' => Yii::t('StoreModule.store', 'Discount price'), 'discount' => Yii::t('StoreModule.store', 'Discount, %'), 'sku' => Yii::t('StoreModule.store', 'SKU'), 'image' => Yii::t('StoreModule.store', 'Image'), 'short_description' => Yii::t('StoreModule.store', 'Short description'), 'description' => Yii::t('StoreModule.store', 'Description'), 'slug' => Yii::t('StoreModule.store', 'Alias'), 'data' => Yii::t('StoreModule.store', 'Data'), 'status' => Yii::t('StoreModule.store', 'Status'), 'create_time' => Yii::t('StoreModule.store', 'Added'), 'update_time' => Yii::t('StoreModule.store', 'Updated'), 'user_id' => Yii::t('StoreModule.store', 'User'), 'change_user_id' => Yii::t('StoreModule.store', 'Editor'), 'is_special' => Yii::t('StoreModule.store', 'Special'), 'length' => Yii::t('StoreModule.store', 'Length, m.'), 'height' => Yii::t('StoreModule.store', 'Height, m.'), 'width' => Yii::t('StoreModule.store', 'Width, m.'), 'weight' => Yii::t('StoreModule.store', 'Weight, kg.'), 'quantity' => Yii::t('StoreModule.store', 'Quantity'), 'producer_id' => Yii::t('StoreModule.store', 'Producer'), 'in_stock' => Yii::t('StoreModule.store', 'Stock status'), 'meta_title' => Yii::t('StoreModule.store', 'Meta title'), 'meta_keywords' => Yii::t('StoreModule.store', 'Meta keywords'), 'meta_description' => Yii::t('StoreModule.store', 'Meta description'), 'purchase_price' => Yii::t('StoreModule.store', 'Purchase price'), 'average_price' => Yii::t('StoreModule.store', 'Average price'), 'recommended_price' => Yii::t('StoreModule.store', 'Recommended price'), 'position' => Yii::t('StoreModule.store', 'Position'), 'external_id' => Yii::t('StoreModule.store', 'External id'), 'title' => Yii::t('StoreModule.store', 'SEO_Title'), 'meta_canonical' => Yii::t('StoreModule.store', 'Canonical'), 'image_alt' => Yii::t('StoreModule.store', 'Image alt'), 'image_title' => Yii::t('StoreModule.store', 'Image title')];
    }

Usage Example

    echo count($selproducts);
    ?>
)</h3>
                                </td>
                            </tr>

                            <?php 
    $count = 1;
    foreach ($selproducts as $key => $val) {
        ?>
                                <tr>
                                    <td>
                                        <div class="ftext">
                                            <?php 
        $Breakfast = new Product();
        $BreakfastAttributes = $Breakfast->attributeLabels();
        //                                e($BreakfastAttributes);
        echo "<h4>Product -" . $count . " </h4>";
        foreach ($val as $vkey => $vval) {
            if (in_array($vkey, array('name', 'desc', 'pic')) && !empty($vval)) {
                if ($vkey == 'pic') {
                    $url = getSiteUrl() . '/productimg/' . $vval;
                    echo ' <div  style="margin-top:10px;"><img width="60%" src=' . $url . '></div>';
                } else {
                    echo ' <div  style=""><span style="color:#0069A4;">' . $BreakfastAttributes[$vkey] . '</span> : ' . $vval . "</div>";
                }
            }
        }
        $count++;
        ?>
                                            <!--</div>-->
All Usage Examples Of Product::attributeLabels