1. sandstorm871
  2. RO CSVI
  3. Thursday, 17 March 2016
  4.  Subscribe via email
Playing around with a Google Base export for Virtuemart.

I have set most of it up and just checking/testing a few bits.

When exporting product_in_stock for the g:availability field, this is putting the actual stock number in place, which I guess is exactly what I am asking CSVi to do, but Google being Google, they don't like that, they want to see a value "in stock" or "out of stock".

Do you have any ideas how I can get CSVi to put these values in place instead of a number.

So if more than zero add "in stock" if zero or less add "out of stock"

Thanks in advance,

Andy
Accepted Answer Pending Moderation
Hello Andy,

You can use the Rules to add a replacement during export for this field. You can have one rule that matches 0 to show "out of stock". You can have another rule that matches 1,2,3,4,5,6,7,8,9 using multiple values and have it show "in stock". There is no rules plugin that can do a greater than or lower than and equal check. Might be a nice idea to add.

Finally if you are really adventurous you could write your own Rules plugin and have it do exactly what you want.
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 1
Accepted Answer Pending Moderation
Thanks for your reply. I pretty much have all the google base export sorted out now, but this availability/stock is an issue.
Having the stock/availability is a compulsory field for the Google feed & must have one of the values;


  1. preorder

  2. out of stock

  3. in stock



Iv'e set up a rule to replace the "0" with "out of stock" , but without a way to change all other numbers to "in stock" , I am not sure what to do.

Adding all numbers 1 through 9999 isn't really an option & I wouldn't know where to start with creating a rules plugin of my own.
And although I personally don't need the "preorder" I am not sure how that could be handled either?
  1. more than a month ago
  2. RO CSVI
  3. # 2
Accepted Answer Pending Moderation
OK, bit of digging with regular expression and this is sorted of in/out of stock. Not sure how you would solve the "preorder" secenario.

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.22-2.png

ScreenShot2016-03-17at22.43.13-2.png

Thanks for pointing me in the right direction
Attachments (2)
  1. more than a month ago
  2. RO CSVI
  3. # 3
Accepted Answer Pending Moderation
Hey Andy,

Thanks for the feedback. That is a good solution.

Adding all numbers 1 through 9999 isn't really an option
I didn't mean to add all the numbers, just the numbers 1 through 9. You don't need any higher numbers. For example if you have 234 in stock, matching the number 2 you know it is above zero, so it can be replaced. That is what I was thinking.

In the future we will have a rule where you can do comparison and change values :)
Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory
  1. more than a month ago
  2. RO CSVI
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!