I'm trying to split the j2store main_image field to get the bit to the left of the '#' using Rules and the multireplace plugin.
The j2store 'main_image' field contains "images/products/t-shirts/carnivore/military-green-1000x1000_Bull_coloured_-_I_also_like_Cake-orange-text-f0a253\.jpg#joomlaImage://local-images/products/t-shirts/carnivore/military-green-1000x1000_Bull_coloured_-_I_also_like_Cake-orange-text-f0a253\.jpg\?width=1000&height=1000"
first I escaped the '.' and the '?' using a text based Find and Replace - that worked. Then I added another line to the Rule,
Then I applied a regex Find and Replace using' /^(.*?)#/' and '$1' respectively. This results is the same string as the original 'main_image' field value but minus the '#'. that is: "images/products/t-shirts/carnivore/military-green-1000x1000_Bull_coloured_-_I_also_like_Cake-orange-text-f0a253.jpgjoomlaImage://local-images/products/t-shirts/carnivore/military-green-1000x1000_Bull_coloured_-_I_also_like_Cake-orange-text-f0a253.jpg?width=1000&height=1000"
regex101.com with the same input value results in the correct "images/products/t-shirts/carnivore/military-green-1000x1000_Bull_coloured_-_I_also_like_Cake-orange-text-f0a253.jpg"
The Rule is applied to the 'main_image' field in the Template, which is where I am getting these results from. i have also used the 'Maintenance' option to cache the SEF urls as suggested.
What am doing wrong here?
- davidcraiguk
- RO CSVI
- Sunday, 07 April 2024
- Subscribe via email
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!