Best way to handle multiple currencies in Rails app - ruby-on-rails-3

I have an where users can create an account and then create an invoice. More international users are using the app which means I need to allow them to set a currency from a dropdown and that's used on their invoices. I'm using number_to_currency everywhere currently, but how do I use that if say the currency code for a user is ES using the relationship current_user.currencies.name?

Ok I figured it out
Install this gem https://github.com/svenfuchs/rails-i18n
From here always use this format now number_to_currency(100,:locale=>'en-GB') you can choose from the list of formats here: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale

Related

Get List of Countries

Not seeing the country list in the database nor any settings around them.
I'm writing a custom shipping methods module and need to convert the three character country code into the two character code.
What is the best way to get the list of countries for use server side?
Unfortunately VC does not contains countries resources for using from server side code. But I would to suggest for you to include this countries JSON from our storefront GitHub repository as embedded resource into your module project and read it as described here.

How do I access Shopify data without advanced account?

All I'm wanting to do is track sales of certain products from a certain date. My company is wanting to add a banner to track sales goals for raising money for charities. So basically, we'd tag a few products as being part of that goal, set a goal, and then need to update the goal progress by a certain amount every time a sale is made on one of those products. As far as I can tell, without access to Shopify's analytics API, this is not possible. How can I do this?
What you want to build is perfectly possible. However, you need to generate Private App Credentials, so you can use Shopify API. It doesn't matter if you have an account by yourself, someone else can follow these steps and send you the credentials your way.
If you don't actually need to modify anything through the API, you could have them set a webhook (Settings -> Notifications -> Webhook) on Order Creation (or similar) that posts to your server and you can check what product got sold and see if it has got the tag.
The "easy" way to do this is to create an app that receives order webhooks and can check on tagged products and keep a sum of target items sold.
Then the app should have use a script tag to insert a simple script with the current value into the web page at a configured place by css selector
OR the app could update one or more snippet files that you could include until the promo is done.
I'd tend to go with the script tag option since that's a bit more flexible and you should be able to change your theme when the promo is over to report results without having to touch the app again.

Big commerce Pay in store option

I created a dummy store using Big Commerce.
It has a Pay In store option, i just wanted to know whether i can let users to check for stores first after choosing the Pay in Store option on the Check Out page and then click the checkout button? I could not find any way to achieve this.
There isn't out of the box functionality in Bigcommerce that allows a customer to choose what store they are going to pay at. You can use an app like Store Finder so your customers could find the store locations closest to them. You can do a workaround like creating shipping zones based on zip codes that are assigned to specific stores or ask customers to specify the pickup store in the order notes.

Shopify API: Create a Promotion?

Using the Shopify API, is there a way to creation promotions for your store? If not, is there a way to programmatically create promotions in Shopify? (short of using CURL posts to the admin)
That is, I can create a promotion by hand using the admin and navigating to the Promotions and clicking the Add a discount code link. I'd like to be able to do the same thing programmatically, or to know for certain this isn't possible. I don't see any obvious method on the api list, but it seems like something should be an API method.
Unfortunately they don't allow it... I resorted to creating an interface to do so, though:
https://github.com/MartinAmps/Shopify-Private-APIs
Hope it helps
Edit
I also created a blog post about it.
There is no way to create discounts via the API.
If you want we have made an application that can be used to create discount codes.
Otherwise you can use a tool like Mechanize to automate coupon creation for you, but keep in mind theres a good chance that any time in the future it will break since we don't make any promises to keep our admin the same in the future. Any changes have a good chance of breaking whatever script you'd end up writing.
The Price Rules API is now public and allow any app to create price rules and discount codes.
https://help.shopify.com/api/price-rules
If you're familiar with Rails or you're already using ActiveResource for your Shopify API calls, then you can drop in this modified version of Discount < ActiveResource::Base https://gist.github.com/choonkeat/09a56da222f506e627c5

Could Prestashop be used to build a craigslist clone?

I'm not so much interested in actually doing this as knowing if Prestashop has the power to allow members to create their own products, classifieds, etc. I've read some articles on Prestashop and played around with it a bit and it looks like the shop owner has to do all the creating and the users consume.
To make client add there own products etc. using prestashop you need to promote all of them at least to managers and grant access to back-office.
But prestashop is just framework as all CMS are. If you have plenty amount of time it is possible to make everything using prestashop source code...
... question is: is it worth?
Especially with the addition of the Webservice in Prestashop 1.4 onwards there's no reason why you couldn't write your own simple "control panel" to give ordinary users some capabilities for creating and managing their own "products".
Obviously you would need to add your own permission scheme (including "ownership") for the products they created, as well as creating the actual product create/edit front end for them.
Definitely possible but non-trivial.
Paul