This topic has 11 replies, 2 voices, and was last updated 2 years, 7 months ago ago by jim2sim
Please read in private
Hello,
Do you use our built-in variation gallery option or do you use a third-party variation gallery plugin?
Regards
I use variation gallery from xstore. I mean default and no third-party.
Hello,
1) Provide us with WP Dashboard and FTP access to your site
2) Tell me your actions to create XML file for the product that you use.
We’ll try some code and need to check if that works in your case.
3) Provide us with link to the variable product that comes with the variation gallery.
Regards
Please change only the custom field what you use on this code.
And i go to add to function. View the code please in private.
READ PRIVATE
Hello,
Thank you. I passed the issue to our developers. I’ll inform you once get the answer from them.
Regards
READ
Hello,
Sorry for the delay, we have a lot of requests. But I’ll try to speed up the process.
Regards
Hello,
Thank you for your patience.
Our developers took a look at the issue and found the following:
Plugin author uses $product->get_image_id() in his code but he should use $attachment_id
https://prnt.sc/bwkqupWZJkZe
It took the main image for each variation gallery image before https://prnt.sc/utcZh4ZSq_f-
after the global plugin code fix, it took the correct images
https://prnt.sc/Bed1dsuAntsi
Code before
public function get_gallery($product) {
$attachment_ids = apply_filters('webexpert_skroutz_xml_custom_gallery', $product->get_gallery_image_ids(), $product);
if (sizeof($attachment_ids)>0) {
foreach ($attachment_ids as $attachment_id) {
$this->xml->startElement('additional_imageurl');
$this->xml->writeCData(esc_html(apply_filters('webexpert_skroutz_xml_custom_image',wp_get_attachment_url($product->get_image_id()),$product)));
$this->xml->endElement();
}
}
}
After
public function get_gallery($product) {
$attachment_ids = apply_filters('webexpert_skroutz_xml_custom_gallery', $product->get_gallery_image_ids(), $product);
if (sizeof($attachment_ids)>0) {
foreach ($attachment_ids as $attachment_id) {
$this->xml->startElement('additional_imageurl');
$this->xml->writeCData(esc_html(apply_filters('webexpert_skroutz_xml_custom_image',wp_get_attachment_url($attachment_id),$product)));
$this->xml->endElement();
}
}
}
We added fix on your website globally in
plugins/webexpert-skroutz-xml-feed/includes/scripts/skroutz-engine-v3.php. Contact plugin author and ask them to fix the code because you will lose this fix after plugin update if they don’t fix it globally.
And we added custom filter in xstore-child/functions.php in addition
add_filter('webexpert_skroutz_xml_custom_gallery','webexpert_skroutz_xml_custom_gallery_custom',20,2);
function webexpert_skroutz_xml_custom_gallery_custom($gallery_image_ids,$product) {
if ( $product->is_type( 'variation' ) ) {
$has_variation_gallery_images = (bool) get_post_meta( $product->get_id(), 'et_variation_gallery_images', true );
if ( $has_variation_gallery_images ) {
$gallery_images = (array) get_post_meta( $product->get_id(), 'et_variation_gallery_images', true );
return $gallery_images;
}
return $gallery_image_ids;
}
return $gallery_image_ids;
}
Regards
Thank you.
The issue related to '‘Product variation images generating in XML file’' has been successfully resolved, and the topic is now closed for further responses