how to get Subscription price on other Landing page - ruby-on-rails

Hi I am trying to add subscription price on our landing page the product price and Compare at price I am fetching them dynamically but for subscription I am using app.
So don't know how to fetch subscription price dynamically.
after lots of searching I do understand that it will use
Variant, selling plan allocation & Price adjustment.
I've tried
{%for variant in product.variants%}
{% for allocation in selling_price_allocation%}
{{variant.selling_price.allocation.price_adjustment.price }}
{%endfor%}{%endfor%}
When I tried to print JSON for variant it shows this:
{"id":45479232838,"title":"1 Bottle of Provitalize","option1":"1 Bottle of Provitalize","option2":null,"option3":null,"sku":"PRV1001-60","requires_shipping":true,"taxable":true,"featured_image":null,"available":true,"name":"Provitalize | Best Natural Weight Management Probiotic - 1 Bottle of Provitalize","public_title":"1 Bottle of Provitalize","options":["1 Bottle of Provitalize"],"price":4446,"weight":85,"compare_at_price":null,"inventory_quantity":-344312,"inventory_management":null,"inventory_policy":"continue","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[{"price_adjustments":[{"position":1,"price":3557}],"price":3557,"compare_at_price":4446,"per_delivery_price":3557,"selling_plan_id":1649574050,"selling_plan_group_id":"978dc42dda6112c25dc10aaf2806db46421bc651"}]}

Related

Need a SUMIF =SUM(C3-(SUM(E3:N3))) but if E14<0 dont subtract

I have simple problem which I can't get the right twist on it.
I have a list of "products" with their stock in the range of D3:D13 with a set price, an original stock and a list of "customers" in the range of E3:L3.
Each customer can take a product and the updated stock currently is:
[=SUM(C3-(SUM(E3:L3))) ]
If we take one person he has his combined cost for how many products he took on E14
If a person pays their cost (E14 > 0) and nulls the products he took currently the updated stock gets rested. That is what I dont want.
Basically: SUM Stock IF (any of E14:L14) > 0 THEN =SUM(C3-(SUM(E3:N3)))
Update:
Example:
https://docs.google.com/spreadsheets/d/1SEssivZ8jCbqedc8TG_PO4uWLN_QzpRQwxJ_bGwHvQg/edit?usp=sharing Hope the link works.
That is basically everything and this works for me currently.
The issue is if a user decides to pay their dept.
For example User 1 pays.
Then the currently calculated price for the user (E14) get's nulled and also the cells for how much products they took (E3:E12).
But then because how it is done currently the updated stock gets updated again with the items the user1 took previously because we nulled the E3:E12. But the products where already taken. That is what I want to prevent.

purchasing in killos and selling in length? how to measure cost algo?

I am stuck in a situation where I need to come up with an effective way to calculate cost of pipes which is bought in KG and is sold in length and record cost for profit calculation in accounts..
things to consider:
Even if i weight the pipes in feet and meter and add conversion quantities it wont work... because the material used in manufacturing varies sometimes there is e.g. 1000ft in 50 kg and sometimes there is 1150ft in the same weight..
The bundles purchased are sometimes of 52kg, 49kg and 50kg.
Ideas:
(a. i could purchase in unit... and sell in feet and have a customization where after every order i have an option to mark the end of product.. and when i mark the end of the product the purchase cost i.e. $1000 can be divided by the length sold... but issue is it might take a week to sell the product, so it wont show accurate profit at end of day alterntively i can have an approximate cost and have it replaced once the item has ended? thats the best i can come up with. The con of this is what if its time for closing accounts of the year and only half of the bundle has been sold?
what would be the most accurate way of handing this logic in any ERP? POS? The reason i tagged Magento, SAP because i am curious how Magento and SAP handles this situation?
I am feeling accountants and accounts and finance related guys can also chip in, so I am adding the accounting tag
You need to have different UoM for this kind of Item.
Purchasing UoM, Inventory UoM, and Sales UoM. I will consider the Inventory and Sales UoM as the same.
Pipe_A001:
Purchase = Kg |
Inventory = meter |
Sales = meter
So, the challenge is to have the measurement in your Inventory UoM then get the price cost, and you need to take into account when you actually receive against the cost they charge in the Invoice.
Ex: you buy on Aug 1, your PO is 50 Kg # $ 10/Kg, so it Cost you $ 500. Receive actually 49 Kg, but they still charge you for the PO amount which is $ 500.
The 49 Kg is not relevant anymore, since you own the item and you will convert to your measurement which is meter. Let's say you measure and it's 320 meter, so the cost per meter is $ 500 / 320m = $ 1.5625/m.
The next batch on Aug 15, you buy another 50 Kg at the same price. Receive 51 Kg, Invoiced $ 500, Length measured 350m. So now you will have the new batch price which is $ 500 / 350m = $ 1.4285/m.
What matters is not the Kg received, but the cost the Supplier Invoiced and the measurement in your Inventory UoM. You might have an agreement with Supplier that they charge only the weight measured at your receiving point.
From this point, it is back to your procedure whether to count as FIFO with different batch or count as Moving Average.

Database Design for product prices depending on time of a day

I'm building a food ordering web application with a standard product/category setup - a category (for example Pizza) has many products (Pizza Salami).
Category
--------
id
name
Product
-------
id
name
category_id
The problem: the price of a category depends on the time of the day. For example for 2pm - 6pm and 9pm - 11pm the price for a pizza is cheaper.
How would I design the prices table and relationships in an effective way?
If your pricing is predictable, you could put a "base price" attribute in the product table, then read it from code, and calculate the "final price", depending on the time. You'll then store that final price in your orders table.
But if you want to be able to read tje final price from the database, I sugest you look into your database documentation, for how to create functions and views.

How to sum up different currencies in Rails app?

I am currently building a Ruby on Rails invoicing application that is multilingual and supports a range of currencies. In the dashboard view all invoices a user has produced are totalled.
Now it would be nice if a user could choose the currency for each invoice.
But how can those invoices be totalled if different currencies are used?
E.g. if these three invoices were created today:
Invoice No. 1: $1000.00
Invoice No. 2: $2000.00
Invoice No. 3: €1000.00
Total: $4333.60
----------------------
The dollar-euro exchange rate would have to be based on each invoice's date of course.
How can this be achieved in Rails and does it even make sense?
Thanks for any pointers.
The sum of of multiple invoices using different currencies is not a single number, it's a collection of numbers. If you have a 20 USD invoice, a 15 EUR invoice, and a 20 EUR invoice, the sum is "20 USD + 35 EUR".
At the time when a payment is made from a single account using a single base currency, then a conversion will be performed to determine how much will have to be paid in that currency to cover the total converted costs. Presumably, there will also be currency conversion fees added at that time.
It would be convenient if you change the currency to a single one, either euro or dollar right when the user makes an invoice. That is, you save the 'converted' value in your database. In this way you won't have to lookup for past day rates.
Eu_central_bank provides exchange rates.

Automatic price change on daily basis in magento

We have a client site who is having gold jewelery magento shop. In that the jewel prices are daily changing,so he have to update each jewel items price often.
(The logic we have here is 1 gram price today is Rs. 1200 and tomorrow it may became RS. 1220 and client is selling 10 gram item as one jewel and 18 gram item as one jewel and so on, so he have to update the price daily for each jewel item based on its weight).
What we are doing now is having a script that checks and updates price daily based on one input field value from admin config section and cron job.
But what i am looking for is(Well truly its not me, but clients wants better than this solution) a way to automatic price change as like % price based on one gram value(Which can be updated by admin daily in configuration section as like now) daily basis. Is there anyway in magento for this? Please advice me.
Thanks
Ela

Resources