Magento Option Question - magento

This seems simple enough in theory but I haven't found anything on it. I need it for a client. Please see this page as an example: http://www.customsportsteamuniforms.com/index.php/test-shirt.html
On that page, you will find the first option that says "What kind of Screen Printing do you want?" If you select 1 color and you also happen to want more than 1 quantity (let's say 5), you will end up with this formula for the product cost:
$5 (cost) x $25 (option) x 5 quantity = total.
I DO NOT want it to do that. The option should be a one time fee in this case. The formula should read:
$5 (cost) x 5 quantity = sub-total + $25 (option) = total
How do I do this?

Magento's additional fees are all calculated on a per-product basis. If you want to add a fee to the entire order, you'll need to add some custom code to add this as a sort of handling fee for the order. The semantics for this are up to you (for instance, what about 2 different shirts both with 1-color screen printing options).

I found a plugin that does this:
http://www.absolutepricing.com/
Although, in my opinion, this should have been part of the system to begin with, but that's neither here nor there...

Related

Magento 1.9 Set an Attribute value calling another value (weight)

So, right now i have 2 shipping options, and since shipping is by weight and my site is B2B, customers want to know the exact final price they are paying, without reaching to cart, for every single product.
So, on the additional information block, i have the weight to display, and i want to add another 2 attributes, one for each shipping cost, the thing is that on each of this attributes, i need to multiply the weight value to a cost per lb...
Example:
Regular shipping cost costs $5 per lb and Express $8 per lb
I have product A that weights 0.34 lbs
So what i need is that when i go into the product page, in the additional info, to see this 2 attributes:
Regular Shipping: (Value would be 0.34 * 5) $1.70
Express Shipping: (Value 0.34 * 8) $2.72
is this possible?
short answer: yes.
it is for sure is possible.
Should't there be more calculation logic? Like minimal shipping cost/weight per carrier?
If you want to re-use magento logic, then a quote object has to be created. Which means putting this product into cart. But since you dont want this simply implement your own logic in a custom block and add it to additional info or whereever you need it.

Reporting Multiple Values & Sorting

Having a bit of an issue and unsure if it's actually possible to do.
I'm working on a file that I will enter target progression vs actual target reporting the % outcome.
PAGE 1
¦NAME ¦TAR 1 %¦TAR 2 %¦TAR 3 %¦TAR 4 %¦OVERALL¦SUB 1¦SUB 2¦SUB 3¦
¦NAME1¦ 114%¦ 121%¦ 100%¦ 250%¦ 146%¦ 2¦ 0¦ 0%¦
¦NAME2¦ 88%¦ 100%¦ 90%¦ 50%¦ 82%¦ 0¦ 1¦ 0%¦
¦NAME3¦ 82%¦ 54%¦ 64%¦ 100%¦ 75%¦ 6¦ 6¦ 15%¦
¦NAME4¦ 103%¦ 64%¦ 56%¦ 43%¦ 67%¦ 4¦ 4¦ 24%¦
¦NAME5¦ 87%¦ 63%¦ 89%¦ 0%¦ 60%¦ 3¦ 2¦ 16%¦
Now I already have it sorting all rows by the Overall % column so I can quickly see at a glance but I am creating a second page that I need to reference points.
So on the second page I would like to somehow sort and reference different columns for example
PAGE 2
TOP TAR 1¦Name of top %¦Top %¦
TOP TAR 2¦Name of top %¦Top %¦
Is something like this possible to do?
Essentially I'm creating an Employee of the Month form that automatically works out who has topped what.
I'm willing to drop a paypal donation for whoever can figure this out for me as I've been doing it manually every month and would appreciate the time saved
I don't think a complicated array formula is necessary for this - I am suggesting a fairly standard Index/Match approach.
First set up the row titles - you can just copy and transpose them from Page 1, or use a formula in A2 of Page 2 like
=transpose('Page 1'!B1:E1)
The use them in an index/match to get the data in the corresponding column of the main sheet and find its maximum (in C2)
=max(index('Page 1'!A:E,0,match(A2,'Page 1'!A$1:E$1,0)))
Finally look up the maximum in the main sheet to find the corresponding name:
=index('Page 1'!A:A,match(C2,index('Page 1'!A:E,0,match(A2,'Page 1'!A$1:E$1,0)),0))
If you think there could be a tie for first place with two or more people getting the same score, you could use a filter to get the different names:
So if the max score is in B8 this time (same formula)
=max(index('Page 1'!A:E,0,match(A8,'Page 1'!A$1:E$1,0)))
the different names could be spread across the corresponding row using transpose (in C8)
=ArrayFormula(TRANSPOSE(filter('Page 1'!A:A,index('Page 1'!A:E,0,match(A8,'Page 1'!A$1:E$1,0))=B8)))
I have changed the test data slightly to show these different scenarios
Results

Joomla K2 content sort by number of votes

I'm using Joomla 2.5 and K2 2.5.7. I have a category with posts with a different number of votes. In the front end, I need to sort the items of this category by number of votes.
I re-configured standard stars rating systems to simple "Give one vote" system.
I need this for a ranking order page, so it will have items with the largest number of votes on the top.
What I have
I have my MVC template for K2 category. I was wondering, if sorting $this->leading in category.php is the right to go for.
If it is, how can I do it? With var_dump there is variable numOfVotes which carry real number of votes. How can I sort this object by this var?
Thank you very much!
This K2 forum post seems to answer your question. You need to use the mod_content k2 module and use the "sort by" parameter and select highest rating.
If you go to 'modules/mod_k2_content/helper.php' in the ftp, you'll see on line 98, that there it says
$query .= ", (r.rating_sum/r.rating_count) AS rating";
This sorts the data by the highest rating. Now generally this would sort it by the number of votes divided by the number of people who have voted giving a result between 1 and 5. However as everyone in your case gets a vote of 5 - then your average result will always be 5 by that calculation!, I think that you'll have to replace that line with:
$query .= ", r.rating_count AS rating";
i.e. just sorting by the number of people who have voted (N.B. This assumes you're not using a vote down system as well! You haven't mentioned it so I'm assuming not)
Then you should just be able to use the module (selecting the parameter that you desire as normal)
For using the component category option etc. Then the same line of code can be found in 'components/com_k2/models/itemlist.php' on Line 39 which again would need to be edited. Then you could just use the built in parameters as usual!

Magento charity coupon code + then ask for which charity (2 step discount for Round Table)

We have a special couponcode 10% off, 3 monhts valid.
Now the 10% goes to charity. And we use the couponcode to identify that it is in fact for charity BUT alas someone has thought up that everybody can decide for themselves which chairt it is. So ....
We need a couponcode that works (check!)
But when entered somewhere there should be an extra box asking for the "charity name"
Options I can think off is directly at coupon input, or add addressfiled (but only when coupon)
Anyone know how to do this easily? or with sme code?
Just create a coupon code for each charity and replace the coupon entrance input with a select box that lists your codes or make a additional select-box that pre-fills the coupon field with right code ?

mortgage calculator in Shoes but it won't divide?

I am new to Ruby and Shoes, I think I have everything. the program appears to work correctly except when I get to the last step. I, enter the loan amount, interest rate, in to edit_lines, when I press the calculate button, it performs the calculations, stores the calculated numbers to a variable. The last step is dividing the total loan (loan and interest) by the length of the loan in months to ge the monthly payment, so I can make a payment table for the entire loan, but I either get in-corredt results or I get no reeults.
I think I converted the integers to floats, etc. , but... not sure. It appears to add, multiply, subtrct, except it will not divide 2 qbjects. If I enter numbers it works ok.
What am I doing wrong. It does seem like it is that difficult. Example code of dividng the values in a varible by the value of another varible?
It looks like you're using eval(), which you almost never, ever want to use. You can do the exact same thing in normal ruby. I'm just guessing right now since the code I can see in your comment is lacking newlines, but I think this code would work:
#numberbox3.text = #totalinterest + #loadamount
#numberbox5.text = #totalloan / #lengthyears
Hope this helps!

Resources