Our attributes are in the format "Size / Color". I would like to split them apart on the basket screen so that it shows:
Size: Small
Color: White
Since I feel like this is easier to understand. We do this outside of Miva Merchant using PHP and the code is simple (for those that understand PHP):
The important parts are that explode() will take a string ($prod_attributes['options_prompt']) and split it at the first instance of " / " (the third parameter in that function ensures that it only splits once, regardless of how many times the string exists). The result of that function is piped into list(), which makes two new variables $size_prompt and $color_prompt.
Now, I've looked through the toolkit functions and I don't think it can explode or use a delimiter for a string. If it can, that would be ideal and we can stop here. If I'm right, the way I was thinking of doing this was using the substring function. If I can find the position of the first occurence of " / " in the string, I can then use substring to show the before and after parts. What I can't figure out how to do is find the position of the string. SMT allows me to test and return the position using IN/CIN, but I don't believe I can use that in the toolkit.
I'm tossing this one out for the toolkit wizards to see if this can be done. If it can't, I 'll be sad, but I'll get over it.
Thanks!
Size: Small
Color: White
Since I feel like this is easier to understand. We do this outside of Miva Merchant using PHP and the code is simple (for those that understand PHP):
Code:
list($size_prompt, $color_prompt) = explode(' / ', $prod_attributes['options_prompt'], 2);
Now, I've looked through the toolkit functions and I don't think it can explode or use a delimiter for a string. If it can, that would be ideal and we can stop here. If I'm right, the way I was thinking of doing this was using the substring function. If I can find the position of the first occurence of " / " in the string, I can then use substring to show the before and after parts. What I can't figure out how to do is find the position of the string. SMT allows me to test and return the position using IN/CIN, but I don't believe I can use that in the toolkit.
I'm tossing this one out for the toolkit wizards to see if this can be done. If it can't, I 'll be sad, but I'll get over it.
Thanks!
Comment