Opencart - Getting a product price in the head? - opencart

I'm trying to get the price of a product in the head for an OpenGraph meta tag that requires the price. I can echo $price anywhere in the main content area fine but anywhere higher it looks like the variable is not yet set. How can I get the price of the current product in the head?

I would use javascript to assign variable value, invoking the price variable in the header.php would require a ton of work, mixing different modules into one controller would be a mess

You must first define price variable in controller/common/header.php, and then use it in header.tpl of your theme.

Related

How to Manage Parent Child Relation Of Options In opencart

i want to add sub option with description depends On parent Option Like
eye wear frame power type(single vision,zero power)
sub options for single vision and and zero power
You can add a new field to the database, or utilize an existing one that you don't currently use.
For example:
EAN
If you don't use EAN, you can simply change the name in the language files:
your_directory/admin/language/en-gb/catalog/product.php
Change:
$_['entry_ean'] = 'EAN';
to
$_['entry_ean'] = 'Single Vision';
and similarly for catalog.
Tags are also used in similar fashion, for items to link/group similar products. (If you want all 'single vision' items to be linkable/grouped together, tags would be the easiest way to go.)

Display both sale price and original price

In bigcartel, is there anyway to have products that are on sale show their original price as well. something like ($̶2̶0̶.̶0̶0̶) $16.00
I'm sure there is some type of code or way to do this. Thanks
There's not currently a way within the Big Cartel admin to specifically set a sale price (in addition to the original price) so unfortunately something like this wouldn't be possible.

How to make a search based on get_field_gender label?

Well, this might be a bit odd, but I was wondering if it is possible to make a search based on the label for choiceFields rather than the stored database value.
I have an app that when the user searches for a vehicle of type truck, the query can't retrieve results because the value stored in the database is tru, although choiceField label is truck. The same goes for gender female is fem, for example.
I could go around this problem with alternative ways, but I was wondering if Django had this implemented somehow.
I think you should consider changing the search functionality to search with the shortened name. You can still display the label on the front-end: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#Examples

osCommerce: custom price based on user input

I am writing a simple JavaScript which will update my price automatically (I know there are addons but they dont work with the nature of my products) when the user enters amount, size etc etc. I want to know how do I override the product price before/after it is sent to the shopping cart?
Example: The product price is 10€. The user select some variatons and then the price is 22,40€. I want to send that price to the checkout instead of the 10€.
So far I have written my JavaScript which updates the price based on user input and selections. I just need to know how to pass that new price variable and more important WHERE.
Any tips or help would be appreciated.
You mention "variations". Are you using attributes? If so, you can simply attach a price adjustment to each option value. That would be the quickest and most proper way to handle variation-specific pricing.

Order totals block on Magento order email and invoice email templates

Can anyone point me to the templates/code blocks that are used for the order totals block on the Magento order mail and invoice e-mail templates?
The tax issue is solved but I need to implement some logic to get rid of the shipping and the subtotal. Which templates are used for the emails?
I found the frontend and changed this as needed, but can't find the template/block that is used for the e-mails sent by the system.
Can anyone point me in the right direction?
Thanks,
Bart
Niels answer of app/design/frontend/base/default/template/sales/order/totals.phtml is correct however I thought some further clarification was in order because one doesn't merely make cosmetic changes to this file in order to effect the desired change. totals.phtml loops over the "totals", each of which produces a total-related line-item (Subtotal, Shipping & Handling, Tax, Grand Total (Excl. Tax), and Grand Total (Incl. Tax)). Your best bet is to use Mage::Log to output each of the totals (which are looped over via an associative array $_code => $total). If you log each key ($_code), you'll see names such as subtotal, shipping, grand_total, tax, and grand_total_incl. I filtered out those from the sales order e-mail that I didn't want by adding the following code directly below the foreach:
<?php if (in_array($_code, array('grand_total'))) {
continue;
} ?>
Hopefully this will help anybody who is puzzling over where these totals are mysteriously coming from. :-)
This template is being used for the totals in the e-mail templates and order overview in My Account:
app/design/frontend/base/default/template/sales/order/totals.phtml
Jason's answer is good for telling Magento to not generate the likes of grand_total HTML. However, you should look at System > Configuration > Sales > Tax to see if you can remove the fields the proper way first.
If you then see a message saying "Warning tax configuration can result in rounding errors" at the top of your admin pages, you'll need to adjust your settings. See the manual for the default settings, if you need them.
I am not entirely sure but could it be this one:
\app\design\adminhtml\default\default\template\email\order\items.phtml
Directory might not exactly match yours but I'm sure you would be able to find it.
HTH