Retrieve and display the sku

I need this H3 to display the sku of our products in Magento 1.9 <h3 class="product-name<?php echo ($_options = $this->getOptionList())? " has-options": ""; ?>"><?php echo $this->escapeHtml($this->getProductName()) ?>&nbsp;<span>SKU: <?php echo $this->escapeHtml($this->getSku());?></span></h3> And so far, it will not display the sku.
5 Replies
Jochem
Jochem2y ago
what is $this in this context? what class I mean also, when you post code, you can wrap it in ```php and ```, and it'll do syntax highlighting ```php print "Hello world"; ``` turns into
print "Hello world";
print "Hello world";
Spiritual Tech
Spiritual TechOP2y ago
$this stands for the product Oh, okay Thanks You could rewrite $this like $product
Jochem
Jochem2y ago
are you getting any errors in your server log? what does the output look like? I'm also having trouble finding any documentation for Magento online, which is weird... do you have a link to the documentation?
MarkBoots
MarkBoots2y ago
just as a test, (without knowing the rest of your code). Does it also fail without the escapeHtml method? then we can rule that one out
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server