ImportXML with flexible conditions - xpath

I have to fetch the price of Lego items
http://mightyutan.com.my/batman-movie/?id_category=1413&n=100
But the challenges here are the price are split into two conditions
No discount, reflect regular price
With discount, show discounted price
How could I use ImportXML for my column to display discounted price, else regular price? I only know to capture a fixed xpath pattern
//div[#class='content_price']/span[#class='price'][1]
Also, I have display the title of the Lego set, for due to the items with no discount, total rows return from my title and price are not tally
Thanks for the help

try this if you want to use include class:
//*[contains(#class,'product-block-inner')]//span[contains(#class,'price')][last()]
or better this when you are sure class won't be changed:
//*[#class = 'product-block']//span[#class='price'][last()]
as discount is located after initial price - just get last price element for product, so it will be discount or if it's not available - initial price =)

Related

How to filter product collection with multiple price range on same time in magento?

I want to filter product listing page collection with multiple price range. Like i want to filter PLP page collection as mentioned below.
40-50
80-90
Above are filtered price ranges and i want plp page collection with this 2 ranges on same time.
I have try to add multiple filter in addFieldtofilter as well as addattributetofilter but it's showing always last range result. Let me know any solution for same.

How to print stock moves with current stock quantity

In Inventory location in module Inventory. It shows list of products in that location and the quantity of available stock. It is easy to print that out with a report.
However, if I want to show the stock moves related to each product quantity and show it under the total of each number of current stock, how can that be done?
For example:
Formatting
Also, I would want to print the data out in this format. How could it be done?
I have tried linking the stock.moves field to the stock.quant model but I am not sure how to present the data in that format with the current stock level as a summary above all related stock.moves

How to show only the above the price of average Prices?

I am stuck at a problem where I don't understand how to filter all the prices that are above average. Here is a picture of the names and prices:
I believe that I have to do this in the Design View, but I have no clue on how to start.
You can use DAvg in your query:
SELECT
Products.[Product Name],
Products.[List Price]
FROM
Products
WHERE
Products.[List Price] > DAvg("[List Price]","[Products]");

Top N by Total Sales in Year X Filter Tableau

How to place a filter in my worksheet that filters a category by top sales in a certain year while still showing all years of data for that category.
Does anyone have an idea how to do this?
One solution is to create a calculated field called Sales_In_Selected_Year that returns the sales for the year you care about and null otherwise such as:
if Year = Selected_Year then Sales end
Place Sales_In_Selected_Year on the filter shelf wth a Top filter and use the original Sales field as desired. Selected_Year can be a parameter for flexibility.

Creating a new Quote Total be factored into Tax

We are creating a new total line item on the quote, such as an oversize charge and this needs to be taken into account when the tax calculation is calculated. We have set it to be before tax, but obviously when looking through the tax total file it doesn't appear to grab other totals or a way to say this total needs to have tax applied.
Has anyone came up with a solution to this?
From what I can remember all the 'footer' totals (I remember them as being in a <tfoot> normally) are based on the subtotal and not each other. If your 'oversize' total block modifies the subtotal after it has been displayed then maybe the tax will calculate the updated value.
In your collect method you can try to add the value to the Subtotal instead of the GradTotal ( $address->setSubtotal ). I'm not sure if it will work or if it will need further adjustments.

Resources