Add JS to head in CartAdd Javascript File To Head For Create BlockPrepend block to Mage Head Block using controller_action_postdispatch event observerRewriting Html Head BlockAdd custom js in head in magento2?Adding New Facebook pixel to <head>Add google tag manager code inside head and bodyMagento2: How to add code inside the head tag?Add inline javascript to head - magento2I have magento 1.9.4 and running 3 stores and want to add a jv script from duda in the headAdd external stylesheet link-rel head tag
Is it necessary to use pronouns with the verb "essere"?
Does the Linux kernel need a file system to run?
Is it allowed to activate the ability of multiple planeswalkers in a single turn?
Does "he squandered his car on drink" sound natural?
Why is the "ls" command showing permissions of files in a FAT32 partition?
How to draw a matrix with arrows in limited space
What fields between the rationals and the reals allow a good notion of 2D distance?
Which Article Helped Get Rid of Technobabble in RPGs?
How does electrical safety system work on ISS?
How to convince somebody that he is fit for something else, but not this job?
Creating two special characters
Giving feedback to someone without sounding prejudiced
Taxes on Dividends in a Roth IRA
C++ check if statement can be evaluated constexpr
How much of a Devil Fruit must be consumed to gain the power?
Mimic lecturing on blackboard, facing audience
Has the laser at Magurele, Romania reached a tenth of the Sun's power?
Do we have to expect a queue for the shuttle from Watford Junction to Harry Potter Studio?
Quoting Keynes in a lecture
Does the reader need to like the PoV character?
Has any country ever had 2 former presidents in jail simultaneously?
What is going on with gets(stdin) on the site coderbyte?
Is this toilet slogan correct usage of the English language?
Why is the Sun approximated as a black body at ~ 5800 K?
Add JS to head in Cart
Add Javascript File To Head For Create BlockPrepend block to Mage Head Block using controller_action_postdispatch event observerRewriting Html Head BlockAdd custom js in head in magento2?Adding New Facebook pixel to <head>Add google tag manager code inside head and bodyMagento2: How to add code inside the head tag?Add inline javascript to head - magento2I have magento 1.9.4 and running 3 stores and want to add a jv script from duda in the headAdd external stylesheet link-rel head tag
I have problem when I want to put JS into head when PHP condition is met, but I'm getting Mage_Core_Exception: Invalid block type excetion no idea why. I have read all the possible issues I have found but looks like there is ton of places I could go wrong and right now Im out of ideas.
I have config.xml where is my module declared. This is only part of it as rest of module is working, also JS and CSS I have in module_name.xml is working properly.
</frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
Then I have module_name.xml I understand that I say here "on checkout/cart page load this template/modulename/prependca.phtml into of page.
<checkout_cart_index translate="label">
<reference name="head">
<block type="namespace_moduleName/cart" name="prependca" template="modulename/prependca.phtml"/>
</reference>
</checkout_cart_index>
Last, but not least, I have this Class of mine:
class Namespace_ModuleName_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
public function prependCa()
$_quote = Mage::getSingleton('checkout/session')->getQuote();
if (get_class($_quote) == Mage_Sales_Model_Quote)
$head = $this->getLayout()->getBlock('head');
$head->addJs('namespace/modulenameTotals.js');
$head->addItem('js', 'namespace/modulenameTotals.js');
From what I have read, I did all I had to do, however I still don't get results and only respond I get is Mage_Core_Exception: Invalid block type
magento-1.9 javascript blocks head
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have problem when I want to put JS into head when PHP condition is met, but I'm getting Mage_Core_Exception: Invalid block type excetion no idea why. I have read all the possible issues I have found but looks like there is ton of places I could go wrong and right now Im out of ideas.
I have config.xml where is my module declared. This is only part of it as rest of module is working, also JS and CSS I have in module_name.xml is working properly.
</frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
Then I have module_name.xml I understand that I say here "on checkout/cart page load this template/modulename/prependca.phtml into of page.
<checkout_cart_index translate="label">
<reference name="head">
<block type="namespace_moduleName/cart" name="prependca" template="modulename/prependca.phtml"/>
</reference>
</checkout_cart_index>
Last, but not least, I have this Class of mine:
class Namespace_ModuleName_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
public function prependCa()
$_quote = Mage::getSingleton('checkout/session')->getQuote();
if (get_class($_quote) == Mage_Sales_Model_Quote)
$head = $this->getLayout()->getBlock('head');
$head->addJs('namespace/modulenameTotals.js');
$head->addItem('js', 'namespace/modulenameTotals.js');
From what I have read, I did all I had to do, however I still don't get results and only respond I get is Mage_Core_Exception: Invalid block type
magento-1.9 javascript blocks head
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
did you try usingcore/template
block?
– Jaimin Sutariya
Sep 24 '17 at 18:27
tried now, surprisingly still same...
– RailBalco
Sep 24 '17 at 19:13
add a comment |
I have problem when I want to put JS into head when PHP condition is met, but I'm getting Mage_Core_Exception: Invalid block type excetion no idea why. I have read all the possible issues I have found but looks like there is ton of places I could go wrong and right now Im out of ideas.
I have config.xml where is my module declared. This is only part of it as rest of module is working, also JS and CSS I have in module_name.xml is working properly.
</frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
Then I have module_name.xml I understand that I say here "on checkout/cart page load this template/modulename/prependca.phtml into of page.
<checkout_cart_index translate="label">
<reference name="head">
<block type="namespace_moduleName/cart" name="prependca" template="modulename/prependca.phtml"/>
</reference>
</checkout_cart_index>
Last, but not least, I have this Class of mine:
class Namespace_ModuleName_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
public function prependCa()
$_quote = Mage::getSingleton('checkout/session')->getQuote();
if (get_class($_quote) == Mage_Sales_Model_Quote)
$head = $this->getLayout()->getBlock('head');
$head->addJs('namespace/modulenameTotals.js');
$head->addItem('js', 'namespace/modulenameTotals.js');
From what I have read, I did all I had to do, however I still don't get results and only respond I get is Mage_Core_Exception: Invalid block type
magento-1.9 javascript blocks head
I have problem when I want to put JS into head when PHP condition is met, but I'm getting Mage_Core_Exception: Invalid block type excetion no idea why. I have read all the possible issues I have found but looks like there is ton of places I could go wrong and right now Im out of ideas.
I have config.xml where is my module declared. This is only part of it as rest of module is working, also JS and CSS I have in module_name.xml is working properly.
</frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
Then I have module_name.xml I understand that I say here "on checkout/cart page load this template/modulename/prependca.phtml into of page.
<checkout_cart_index translate="label">
<reference name="head">
<block type="namespace_moduleName/cart" name="prependca" template="modulename/prependca.phtml"/>
</reference>
</checkout_cart_index>
Last, but not least, I have this Class of mine:
class Namespace_ModuleName_Block_Cart extends Mage_Checkout_Block_Cart_Abstract
public function prependCa()
$_quote = Mage::getSingleton('checkout/session')->getQuote();
if (get_class($_quote) == Mage_Sales_Model_Quote)
$head = $this->getLayout()->getBlock('head');
$head->addJs('namespace/modulenameTotals.js');
$head->addItem('js', 'namespace/modulenameTotals.js');
From what I have read, I did all I had to do, however I still don't get results and only respond I get is Mage_Core_Exception: Invalid block type
magento-1.9 javascript blocks head
magento-1.9 javascript blocks head
asked Sep 24 '17 at 17:44
RailBalcoRailBalco
51
51
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 14 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
did you try usingcore/template
block?
– Jaimin Sutariya
Sep 24 '17 at 18:27
tried now, surprisingly still same...
– RailBalco
Sep 24 '17 at 19:13
add a comment |
did you try usingcore/template
block?
– Jaimin Sutariya
Sep 24 '17 at 18:27
tried now, surprisingly still same...
– RailBalco
Sep 24 '17 at 19:13
did you try using
core/template
block?– Jaimin Sutariya
Sep 24 '17 at 18:27
did you try using
core/template
block?– Jaimin Sutariya
Sep 24 '17 at 18:27
tried now, surprisingly still same...
– RailBalco
Sep 24 '17 at 19:13
tried now, surprisingly still same...
– RailBalco
Sep 24 '17 at 19:13
add a comment |
1 Answer
1
active
oldest
votes
Go to
app/design/frontend/package/theme/layout/local.xml
then add this :<checkout_cart_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action>
</reference>
</checkout_cart_index>Create your new js file in:
skin/frontend/package/theme/js/my-custom.js
then put your code inside.Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache.
NB: I see some errors in your code:
1)
<frontend> // not </frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
2)
You can't load this type of block in a head ! but you can do it content
, root
etc...
If you need is to add a js file, follow my solution.
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f194509%2fadd-js-to-head-in-cart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Go to
app/design/frontend/package/theme/layout/local.xml
then add this :<checkout_cart_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action>
</reference>
</checkout_cart_index>Create your new js file in:
skin/frontend/package/theme/js/my-custom.js
then put your code inside.Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache.
NB: I see some errors in your code:
1)
<frontend> // not </frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
2)
You can't load this type of block in a head ! but you can do it content
, root
etc...
If you need is to add a js file, follow my solution.
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
add a comment |
Go to
app/design/frontend/package/theme/layout/local.xml
then add this :<checkout_cart_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action>
</reference>
</checkout_cart_index>Create your new js file in:
skin/frontend/package/theme/js/my-custom.js
then put your code inside.Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache.
NB: I see some errors in your code:
1)
<frontend> // not </frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
2)
You can't load this type of block in a head ! but you can do it content
, root
etc...
If you need is to add a js file, follow my solution.
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
add a comment |
Go to
app/design/frontend/package/theme/layout/local.xml
then add this :<checkout_cart_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action>
</reference>
</checkout_cart_index>Create your new js file in:
skin/frontend/package/theme/js/my-custom.js
then put your code inside.Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache.
NB: I see some errors in your code:
1)
<frontend> // not </frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
2)
You can't load this type of block in a head ! but you can do it content
, root
etc...
If you need is to add a js file, follow my solution.
Go to
app/design/frontend/package/theme/layout/local.xml
then add this :<checkout_cart_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action>
</reference>
</checkout_cart_index>Create your new js file in:
skin/frontend/package/theme/js/my-custom.js
then put your code inside.Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache.
NB: I see some errors in your code:
1)
<frontend> // not </frontend>
<layout>
<updates>
<module_name>
<file>module_name.xml</file>
</module_name>
</updates>
</layout>
</frontend>
2)
You can't load this type of block in a head ! but you can do it content
, root
etc...
If you need is to add a js file, follow my solution.
edited Sep 24 '17 at 20:49
answered Sep 24 '17 at 20:23
PЯINCƏPЯINCƏ
8,34631143
8,34631143
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
add a comment |
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
i tried changing from head to content or root, but still doesnt work. My main problem is that I cant use theme...
– RailBalco
Sep 25 '17 at 8:01
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
What kind of block do you want to add ?, it's a Js file ?
– PЯINCƏ
Sep 25 '17 at 8:02
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f194509%2fadd-js-to-head-in-cart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you try using
core/template
block?– Jaimin Sutariya
Sep 24 '17 at 18:27
tried now, surprisingly still same...
– RailBalco
Sep 24 '17 at 19:13