Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Sign Up

Recommended Posts

Добрый день всем. Хочу в модуле вывести id категории для товара. 

Помогите реализовать вывод, сейчас такой код: 

 

$querys = $this->db->query("SELECT category_id FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . $product_info['product_id'] . "'");
                    
                    $data['products'][] = array(
                        'product_id'  => $product_info['product_id'],
                        'thumb'       => $image,
                        'name'        => $product_info['name'],
                        'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
                        'price'       => $price,
                        'special'     => $special,
                        'tax'         => $tax,
                        'rating'      => $rating,
                        'href'        => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
                        'catid' => $querys

Выводит так: 

 

Array
(
    [product_id] => 50
    [thumb] => http://infinifine.com/image/cache/catalog/logo-109x146.png
    [name] => тест товар
    [description] => тест товар..
    [price] => 100р.
    [special] => 
    [tax] => 
    [rating] => 0
    [href] => http://infinifine.com/index.php?route=product/product&product_id=50
    [catid] => stdClass Object
        (
            [num_rows] => 1
            [row] => Array
                (
                    [category_id] => 75
                )

            [rows] => Array
                (
                    [0] => Array
                        (
                            [category_id] => 75
                        )

                )

        )

)

 

 

Как мне вывести чтобы в цикле было [catid] => 75 ?

Знаю что в 'catid' => Надо делать типа $this->row->category_id()  Но это не помогает, ошибку дает

Link to post
Share on other sites

Guest

Это заменить

45 минут назад, Frost56rus сказал:

[catid] => stdClass Object

 

на это 'catid' => $querys->row['category_id']

 

Link to post
Share on other sites
22 минуты назад, nexus сказал:

Это заменить

 

на это 'catid' => $querys->row['category_id']

 

Все заработало, спасибо)

 

Edited by Frost56rus
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.