Post by hilmikeltin » Wed Mar 21, 2018 5:00 am

$this->model_tool_image->resize($product['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'))
(https://www.example.com/image/cache/catalog/product.jpg)

can get main image url above line. i need all product image urls

(https://www.example.com/image/cache/catalog/product.jpg)
(https://www.example.com/image/cache/cat ... oduct1.jpg)
(https://www.example.com/image/cache/cat ... oduct2.jpg)

$results = $this->model_catalog_product->getProductImages($product['product_id']);
foreach ($results as $result) {
$data['images'][] = array(
----i can not connect the logic here-----
$output .= '<image>';
$output .= '</image>';

Newbie

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by straightlight » Wed Mar 21, 2018 5:18 am

No OC version posted.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by hilmikeltin » Wed Mar 21, 2018 2:30 pm

hello, it is 2.1.0.2 version,

Newbie

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by straightlight » Wed Mar 21, 2018 7:07 pm

From which controller filename are you posting these codes from?

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by hilmikeltin » Thu Mar 22, 2018 2:02 am

hello again,

created xml file under catalog/controller/feed/. used a free xml feed and modified to my purpose up to images :).

loads
$this->load->model('catalog/product');
$this->load->model('catalog/category');
$this->load->model('tool/image');

-------------can get options with their stocks-----------------------------
$options = $this->model_catalog_product->getProductOptions($product['product_id']);
foreach ($options as $option) {
foreach ($option['product_option_value'] as $value) {
$output .= '<Stock>';
$output .= '<Spec name="' . $option['name'] . '" >' . $value['name'] . '</spec>';
$output .= '</Stock>';

-------------can get main image----------------------------
$output .= '<image>' . $this->model_tool_image->resize($product['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')) . '</image>';

but the other images :(

Newbie

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by straightlight » Thu Mar 22, 2018 2:19 am

According to Google's API documentation: https://support.google.com/merchants/an ... 2112?hl=en , assuming you have this portion of code:

Code: Select all

if ($product['image']) {
							$output .= '  <g:image_link>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</g:image_link>';
						} else {
							$output .= '  <g:image_link></g:image_link>';
						}
						
Add below:

Code: Select all

$additional_images = $this->model_catalog_product->getProductImages($product['product_id']);

						foreach ($additional_images as $additional_image) {
							$output .= '  <g:additional_image_link>' . $this->model_tool_image->resize($additional_image['image'], $this->config->get($this->config->get('config_theme') . '_image_popup_width'), $this->config->get($this->config->get('config_theme') . '_image_popup_height')) . '</g:additional_image_link>';
						}
This should resolve this issue.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by hilmikeltin » Thu Mar 22, 2018 5:14 am

this does not work. do not understand where additional_images [image] is identified, since additional image is not an opencart variable. this isnot fot google. we would like to give our extra images links to customers whose can use our images.

$pictures_data = $this->model_catalog_product->getProductImages($product['product_id']);
$images = array();
foreach ($pictures_data as $picture_data) {

$images[] = array(
'popup1' => $this->model_tool_image->resize($picture_data['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'))
);
}

$output .= '<image>' . $product['image'] . '</image>';

Newbie

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by hilmikeltin » Thu Mar 22, 2018 5:25 am

i have 5 images for this product. with below image 4 url comes to xml (why? ), but the rest is not seen.

$pictures_data = $this->model_catalog_product->getProductImages($product['product_id']);
$images = array();
foreach ($pictures_data as $picture_data) {

$images[] = array(
'popup1' => $this->model_tool_image->resize($picture_data['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'))
);
}
$output .= '<image>' . $this->model_tool_image->resize($product['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')) . '</image>';

Newbie

Posts

Joined
Thu Nov 23, 2017 6:17 am

Post by straightlight » Thu Mar 22, 2018 5:29 am

You are only posting partial codes which hardens supporters to provide an accurate answer to your question. In order to rectify this issue, please post your complete solution as a file attachment.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by hilmikeltin » Thu Mar 22, 2018 5:47 am

thanks for your help. anyhow these codes are very good start point whose get the extra images url. i will share if i can solve.

Newbie

Posts

Joined
Thu Nov 23, 2017 6:17 am
Who is online

Users browsing this forum: No registered users and 106 guests