price filter problem in magento - magento

In magento sidebar basically how the price filter option is working, i went through all the templte and block files under my custom design.
I am getting this ranges by default.
1. $0.00 - $10,000.00 (1027)
2. $10,000.00 - $20,000.00 (3)
3. $20,000.00 - $30,000.00 (1)
These limits are automatically taken but i want give my own ranges, but they are using only one template file called filter.phtml if i touch that then all other filter options are having problem. How can i customize this price filter as per my own set of ranges?
I need something like this
# $40.00 - $60.00 (155)
# $60.00 - $80.00 (150)
# $80.00 - $100.00 (153)
# $100.00 - $200.00 (248)
# $200.00 - $300.00 (100)
# $300.00 - $400.00 (43)
# $400.00 - $500.00 (20)
# $500.00 - $600.00 (6)
# $600.00 - $700.00 (6)
# $700.00 - $800.00 (2)

If you look in filter.phtml, you will see that it is using the block Mage_Catalog_Block_Layer_Filter_xxx where xxx is the attribute type. Which in turn leads you to the model: Mage_Catalog_Model_Layer_Filter_Price.
Inside app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php, you will see the method getPriceRange() which calculates the price breaks.
You can override that model by copying it into app/code/local/Mage/Catalog/Model/Layer/Filter and adjusting that method so that it calculates the ranges per your requirements.
Good luck.
JD

Related

Rasa how to get a value (slot) from a user

I want rasa to respond to a user when they ask for a forecast for a part number.
From what I have read, I understand I need to use a slot, but I can't find a clear example that I can understand on how to get the part number from the user.
It would give me a head start if I could see an example nlu, story and domain where
the user is asked for a part number
The user enters the part number
Rasa responds with the part number.
here is what I have so far.
domain.yml
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- get_supplier_forecast
entities:
- partnumber
slots:
partnumber:
type: text
templates:
utter_greet:
- text: Hey! How are you?
utter_cheer_up:
- text: 'Here is something to cheer you up:'
image: https://i.imgur.com/nGF1K8f.jpg
utter_did_that_help:
- text: Did that help you?
utter_happy:
- text: Great, carry on!
utter_goodbye:
- text: Bye
utter_iamabot:
- text: I am a bot, powered by Rasa.
utter_get_part_number:
- text: can you give me the part number please
utter_give_me_a_minute_while_i_check:
- text: Give me a minute while I see if I can find a forecast for {partnumber}
utter_confirm_part_number:
- text: Thanks you asked for forecast for {partnumber} did this help?
actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
- utter_iamabot
- utter_get_part_number
- utter_give_me_a_minute_while_i_check
- utter_confirm_part_number
nlu.md
## intent:greet
- hey
- hello
- hi
- good morning
- good evening
- hey there
## intent:goodbye
- bye
- goodbye
- see you around
- see you later
## intent:affirm
- yes
- indeed
- of course
- that sounds good
- correct
## intent:deny
- no
- never
- I don't think so
- don't like that
- no way
- not really
## intent:mood_great
- perfect
- very good
- great
- amazing
- wonderful
- I am feeling very good
- I am great
- I'm good
## intent:mood_unhappy
- sad
- very sad
- unhappy
- bad
- very bad
- awful
- terrible
- not very good
- extremely sad
- so sad
## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
## intent:get_supplier_forecast
- Give me a forecast
- Give me a part number forecast
- I want a forecast
- I want a part number forecast
- I want a forecast for a part
- I want a supplier forecast
- Forecast delivery date
- I need a part number delivery date
- I need an item delivery date
- When will i get a part delivered
stories.md
## happy path
* greet
- utter_greet
* mood_great
- utter_happy
## sad path 1
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* affirm
- utter_happy
## sad path 2
* greet
- utter_greet
* mood_unhappy
- utter_cheer_up
- utter_did_that_help
* deny
- utter_goodbye
## say goodbye
* goodbye
- utter_goodbye
## bot challenge
* bot_challenge
- utter_iamabot
## give me a forecast
* get_supplier_forecast{"partnumber":"J12345-001"}
- slot {"partnumber":"J12345-001"}
- utter_get_part_number
- utter_confirm_part_number
Domain file remain as the same. Try below things.
Story file:
## give me a forecast path1
* get_supplier_forecast{"partnumber":null}
- slot {"partnumber":null}
- utter_get_part_number
## give me a forecast path2
* get_supplier_forecast{"partnumber":"J12345-001"}
- slot {"partnumber":"J12345-001"}
- utter_confirm_part_number
Include this NLU file:
## intent:get_supplier_forecast
#this is how to mention slots in nlu file
- ['J12345-001'](partnumber)
Note: I don't know what is "partnumber" in your case. If there is so many of them you might wanna use "lookup tables".
From above changes first if the slot is null utter_get_part_number will trigger and if the slot is filled with a value utter_confirm_part_number will trigger
If this doesn't fulfill your need or doesn't work as expected, you can try rasa interactive training. Just run rasa interactive on CMD or try rasa x interactive talk. From this you can choose what you expect from the bot

How to extract all rows, for which row a particular criteria is met? Details in description

I am trying to load a set of policy numbers in my Target based on below criteria using Informatica PowerCenter.
I want to select all those rows of policy numbers, for which policy the Rider = 0
This is my source: -
Policy Rider Plan
1234 0 1000
1234 1 1010
1234 2 3000
9090 0 2000
9090 2 2545
4321 3 2000
4321 1 2000
Target should look like this: -
Policy Rider Plan
1234 0 1000
1234 1 1010
1234 2 3000
9090 0 2000
9090 2 2545
The policy number 4321 would not be loaded.
If I use filter as Rider = 0, then I miss out on below rows: -
1234 1 1010
1234 2 3000
9090 0 2000
9090 2 2545
What would be ideal way to load this kind of data using PowerCenter Designer?
Take the same source in one more qualifier in same mapping, use a filter as Rider=0 to get list of unique policy numbers that has Rider=0, then use a joiner with your regular source on policy number. This should work.
Another method, sort your data based on policy and Rider, and use variable ports with condition similar to below.
v_validflag=IIF(v_policy_prev!=policy, IIF(Rider=0, 'valid','invalid'), v_validflag)
v_policy_prev=policy
Then filter valid records.
There are many options. Here are two...
First:
It'll look like:
// AGGREGATOR \\
SOURCE >> SOURCE QUALIFIER >> SORTER << >> JOINER >> TARGET
\\============//
Connect all ports from Source Qualifier (SQ) to SORTER transformation (or sort in SQ itself) and define sorting Key for ‘Policy’ and ‘Rider’. After that split stream into two pipelines:
- Connect ‘Policy’ and ‘Rider’ to FILTER transformation and filter records by ‘Rider’ = 0. - After that link ‘Policy’ (only) to AGGREGATOR and set Group By to ‘YES’ for ‘Policy’. - Add a new port with FIRST or MAX function for ‘Policy’ port. This is to remove duplicate ‘Policy’-es.- Indicate ‘Sorted Input’ in the AGGREGATOR properties.- After that link ‘Policy’ from AGR to JOINER as Master in Port tab.
2.- Second stream, from SORTER, directly link to above JOINER (with aggregated ‘Policy’) as Detail. - Indicate ‘Sorted Input’ in the JOINER properties. - Set Join Type as ‘Normal Join’ and Join Condition as POLICY(master)=POLICY(detail) in JOINER properties.
... Target
Second option:
Just Override SQL in Source Qualifier...
WITH PLC as (
select POLICY
from SRC_TBL
where RIDER=0)
select s.POLICY, s.RIDER, s.PLAN
from PLC p left JOIN SRC_TBL s on s.POLICY = p.POLICY;
may vary depend on your source table constructions...

Magento table rate shipping - exclude some regions from shipping

I have setup a table rate shipping in Magento 1.9. I need to exclude some region from shipping.
For eg., In CSV there are 2 rows, in this format:
Country code - Region - postal - thrashhold - shipping cost
1. FR - Corsica - * - 0 - 18
2. * - * - * - 0 - 50
Currently, If I select France - Corsica in shipping calculator, then it returns shipping cost as 18, which is correct. If I select France - any other region then it shows shipping cost 50, which is not as requirement. Is it possible to restrict other regions, if I select France - any other region?
As per your CSV format condition on 2nd line is applied for all the location except FR-Corsica.You need to remove the second line then It must work as expected.
I think, I got it. I need to remove the regions from tables: directory_country_region and directory_country_region_name, then it wont give option to select other regions of France. Then the shipping can be restricted for these regions.
Only change order of rows
Example:
Country code - Region - postal - thrashhold - shipping cost
1. * - * - * - 0 - 50
2. FR - Corsica - * - 0 - 18

Magento Tax Calculation Incorrect

Hi currently running into an issue with magento 1.9 tax calculations.
I have a product setup as £10.82 with VAT of 20% to be added. The price including VAT is £12.98.
When 1 product is added to the cart everything is ok but if I add 7 the total should be £90.86 but its showing as:
Subtotal - £75.74
VAT - £15.15
Total - £90.89
Therefore 3p of VAT extra is added. Please advise on how I can fix this.
This is not a bug. Total £90.89 is correct but if you want total sum without "extra" 3p of VAT, you can select a different method of calculating VAT.
£10,82 * 20% = £2,164 = £2,16
total: 7 * (£10,82+£2,16) = £90,86
vs
7 * £10,82 = £75,74
£75,74 * 20% = £15,148 = £15,15
total: £75,74 + £15,15 = £90,89
Check Tax Calculation Method in Settings.

WINBUGS : adding time and product fixed effects in a hierarchical data

I am working on a Hierarchical panel data using WinBugs. Assuming a data on school performance - logs with independent variable logp & rank. All schools are divided into three categories (cat) and I need beta coefficient for each category (thus HLM). I am wanting to account for time-specific and school specific effects in the model. One way can be to have dummy variables in the list of variables under mu[i] but that would get messy because my number of schools run upto 60. I am sure there must be a better way to handle that.
My data looks like the following:
school time logs logp cat rank
1 1 4.2 8.9 1 1
1 2 4.2 8.1 1 2
1 3 3.5 9.2 1 1
2 1 4.1 7.5 1 2
2 2 4.5 6.5 1 2
3 1 5.1 6.6 2 4
3 2 6.2 6.8 3 7
#logs = log(score)
#logp = log(average hours of inputs)
#rank - rank of school
#cat = section red, section blue, section white in school (hierarchies)
My WinBUGS code is given below.
model {
# N observations
for (i in 1:n){
logs[i] ~ dnorm(mu[i], tau)
mu[i] <- bcons +bprice*(logp[i])
+ brank[cat[i]]*(rank[i])
}
}
}
# C categories
for (c in 1:C) {
brank[c] ~ dnorm(beta, taub)}
# priors
bcons ~ dnorm(0,1.0E-6)
bprice ~ dnorm(0,1.0E-6)
bad ~ dnorm(0,1.0E-6)
beta ~ dnorm(0,1.0E-6)
tau ~ dgamma(0.001,0.001)
taub ~dgamma(0.001,0.001)
}
As you can see in the data sample above, I have multiple observations for school over time. How can I modify the code to account for time and school specific fixed effects. I have used STATA in the past and we get fe,be,i.time options to take care of fixed effects in a panel data. But here I am lost.

Resources