(DONE) Data Import/Export & Pricing

Hello can anyone in this good forum to answer my problem?
PS* sorry my english is not that good.

All my data was in rich text font = arial (100% sure). I exported my CSV file and open it with my MS Excel 2007, add some info there (just plain numbers), save it using CTRL+S but once i imported my file and view my dynamic pages, the text font were change to times new roman but some are not.

All i want is to keep the font ARIAL from export to import or vice versa. Different font doesn’t look good.

2nd > Is anyone here has idea how to put pricing?
Example:

Tour # 1 Rate is in Japanese yen but automatically converted to USD just changing the conversion source. like excel Cell 1 / Cell 100 = USD
Cell 1 JPY / Cell 100 Conversion rate.

So Cell 100 is a the source. Once it change, all rates will change compute automatically.

*I don’t want to update rate per item. Time consuming i think!
*Before i used Google Spreadsheet as html. But it cannot run into repeater which i need to put it in every item.

Thank you in advance.

Hi, thanks for your questions.

According fonts, I may assume there was some issue with rich text markup during editing in excel. It would be great if you able to add your .csv files you worked with here. It’s hard to say what has happened wrong without real example.

Second question. Although, Wix Code content manager is not the same as a spreadsheet , I have a workaround for you. I may propose you to add an additional collection with only one cell which contains Conversion rate. Then your steps

Please let me know if it helps you or not.

Dear Mr. Khudik,
Thank you for a very informative instruction and tips. For the exporting/importing, i will try to avoid this time and use a very basic format. I am sorry, im not that expert in encoding codes and etc. I think its too complicated to the number conversion for pricing. I just want to avoid updating every single item price because i might mistype and cause trouble to our customer. I don’t know if my idea is possible in wix but i saw some travel agency website automatically convert rates (im thinking if they do it manually or there’s a easy way. by the way, thank you very much for help. Will study more in creating good website and hope i find an easy way to solve my idea.

You’re always welcome.

According the fonts - please notice, that if you see an issue, it doesn’t mean you should avoid your solution. We would happy to help and fix the issue.

Sorry, did I understand you right, that the solution I’ve proposed looks complicated? If so, I can write this hook for you and you will need only to write names of your collections and fields in this code snippet.

Hello Mr. Khudik,

Thank you for answering my inquiry. Since its not a big deal with the font, i can manage it and find the solution with myself time to time. :slight_smile:

Regarding the pricing and hooks, can you help me by providing a code
Someone gave me with this code and after that, i don’t know what to do.

What i just did is copied it to my data.js (at the back end) and it creates column on my collection.
export function myCollection_afterQuery(item, context) { item.price *= item.conversion; return item; }

After that i don’t know how the multiplication will be process.
And how should i received the answer on the multiplication on text box?

Thank you

Okay, my solution is similar to what you have, but more accurate.

  • Let’s assume you have collection PriceCollection with columns JPY and USD. JPY contains your actual prices. I suggest you to add another collection ConversionCollection with column Rate, which will contain only one cell with your actual conversion rate.
  • Then replace your code in data.js with this one
import wixData from 'wix-data';

export async function ConversionCollection_afterUpdate(currentItem, context) {
 const { items } = await wixData.query('PriceCollection').find()
 items.forEach((item) => {
   wixData.update('PriceCollection', Object.assign({}, item, {usd: item.jpy * currentItem.rate}))
 })
 return currentItem;
}
  • Bind your textBox to PriceCollection USD column
  • Go to ConversionCollection and change value inside of Rate cell. Each time you change value in this cell, your values in PriceCollection USD column will be automatically updated. Please also don’t forget to sync your sandbox database with live database after each update

Hope this will help you!

Hello Mr. Khudic, sorry for my late reply.

I found a solution on my inquiry by using the backend with the code below

export function JapanTours_afterQuery(item, context) {
item.conversion = 97;
item.adtusd = (item.adtjpy / item.conversion + 2);
item.adtusd = item.adtusd.toFixed(0);

item.cwbbusd = (item.cwbbjpy / item.conversion + 2); 
item.cwbbusd = item.cwbbusd.toFixed(0); 

item.cwobbusd = (item.cwobbjpy / item.conversion + 2); 
item.cwobbusd = item.cwobbusd.toFixed(0); 

return item;
}

It require’s many column on database but it’s working very great.
If i change the 97 to another number, it will automatically update converted my rates.

Wix is really interesting.

Thank you for the help since the beginning of my inquiry.
Really appreciates.

Hope some one will also make a tutorial on how to make a comment box
on dynamic pages (not wix store). Thank you

can i import data from out side wix