Support is online

Rules: Replace product_in_stock (number) to Text #7984

Open davidex21 opened this topic Friday, 22 January 2016 · 4 replies
Author

Hello. I want to know if through rules (for google base), I can create a rule example: if: product_in_stock = 0; out of stock, if: product_in_stock >= 1; in stock.

Thank you

Support

Hello,

You can create these rules. The 0 is easy, as you just need to check if the value is equal to 0 then replace it with "Out of stock". Then you need another rule to check if the value is 1 - 9 and replace it with "In stock". Finally the last one is harder, as you will need to use a regular expression to see if the value contains 2 or more numbers. So you will need to read up on using regular expressions.

You could also make a rule to replace multiple values and you add all the numbers there.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

you give me an example?

Support

you give me an example?

I gave it to you in my previous post.

You can read all about replacements in the documentation. It has screenshots as well.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

I can create a rule example: if: product_in_stock = 0; out of stock, if: product_in_stock >= 1; in stock.

Hi David,
I'm in the exactsame boat as you. I had initially asked if you had solved this, but this is an edit as I have now solved it & sharing here for you & others.

I set up these below rules & added them to the stock/availability field in the google base export template that I have set up

1st I set up a rule for out of stock.
Find: /^0/
Replace: out of stock
Set as regular expression

2nd I Set up a rule for In stock assuming stock is not greater than 99999
Find: /^(?=.[1-9].)[0-9]{1,5}$/
Replace: in stock
Set as regular expression

ScreenShot2016-03-17at22.43.13.png

ScreenShot2016-03-17at22.43.22.png

Nil Satis Nisi Optimum !

Log in to reply to this topic.