- This topic has 7 replies, 2 voices, and was last updated 7 years, 3 months ago by Jie.
-
AuthorPosts
-
June 14, 2017 at 10:29 pm #13593JieParticipant
Hello,
it seems the plugin is not compatible with WCML.
I go to the advanced option and add the {titlefield} – {_price} to the title field. But I want it to show the multi prices in different languages (it only shows the price in original currency).
Could you please make it possible? Or it does nothing to me.
Thank you
Jie
June 15, 2017 at 9:10 am #13603Ernest MarcinkoKeymasterHi,
Thank you for the information!
I’m not able to view the site, I’m getting an error page: “Your access to this site has been limited’
Can you please check that?June 15, 2017 at 9:14 am #13604JieParticipantThank you.
Now it should be accessible.
Regards
Jie
June 15, 2017 at 10:27 am #13610Ernest MarcinkoKeymasterThank you!
Can you please also check the FTP, I just tried to log-in, but I can only see an empty folder.
June 15, 2017 at 10:47 am #13613JieParticipantYou cannot access this content.
June 15, 2017 at 7:13 pm #13623JieParticipantThank you.
It works fine.
June 15, 2017 at 7:58 pm #13624Ernest MarcinkoKeymasterHi!
You are welcome. I’ve added a custom code to the functions.php file in your theme directory to make it work, please leave it there.I also had to modify the plugin code to recognize the current currency. I will make sure to add that modification to the upcoming release so you won’t have to worry about updates.
For future reference, I leave the custom code here: https://gist.github.com/anag0/c26e263ab568fd4a790ce66ca522a384
June 15, 2017 at 8:03 pm #13625JieParticipant[code]add_filter(‘asp_results’, ‘asp_display_price_w_currency’, 10, 4);
function asp_display_price_w_currency($results, $sid, $is_ajax, $args) {
if ( empty($args[‘woo_currency’]) )
return $results;
global $woocommerce;
global $sitepress;
global $woocommerce_wpml;
$currency = $args[‘woo_currency’]; // GET THIS FROM A PARAMforeach ($results as $k=>&$r) {
if ( isset($r->post_type) &&
in_array($r->post_type, array(‘product’, ‘product_variation’))
) {
$p = wc_get_product( $r->id );
$price = $woocommerce_wpml->multi_currency->prices->get_product_price_in_currency( $r->id, $currency );
$r->title .= ‘ – ‘ . wc_price($price, array(‘currency’ => $currency));
}
}
return $results;
}[/code] -
AuthorPosts
- You must be logged in to reply to this topic.