मुझे मददगार, उनके तरीकों और उत्पाद विशेषताओं के साथ स्वयं को परिचित करने में सहायता चाहिए। विशेष रूप से: $_helper->productAttribute($product, $attributeHtml, $attributeName)
उत्पाद पेजों के लिए उत्पाद एट्रिब्यूट() विधि को समझने में सहायता की आवश्यकता है
यहां फ़ाइलें मैं उपयोग कर रहा हूँ/समीक्षा कर रहे हैं:
app\code\core\Mage\catalog\helper\output.php
app\design\frontend\[theme name]\template\catalog\product\view\media.phtml
कोड की निम्न पंक्ति उत्पाद छवि के लिए एचटीएमएल उत्पन्न करता है।
echo $_helper->productAttribute($_product, $_img, 'image');
सहायक वर्ग कोड कोड के निम्नलिखित टुकड़ों में विधि का वर्णन करता है। क्या लौटाया जा रहा है, क्या कदम हैं, और मैं टेम्पलेट फ़ाइल की पिछली पंक्ति में वर्णित आईएमजी एचटीएमएल को प्रतिबिंबित करने के बजाय इस विधि का उपयोग क्यों करूं?
public function getHandlers($method)
{
$method = strtolower($method);
return isset($this->_handlers[$method]) ? $this->_handlers[$method] : array();
}
public function process($method, $result, $params)
{
foreach ($this->getHandlers($method) as $handler) {
if (method_exists($handler, $method)) {
$result = $handler->$method($this, $result, $params);
}
}
return $result;
}
public function productAttribute($product, $attributeHtml, $attributeName)
{
/* Code that is not relevant to this example */
$attributeHtml = $this->process('productAttribute', $attributeHtml, array(
'product' => $product,
'attribute' => $attributeName
));
return $attributeHtml;
}
किसी भी मदद की सराहना की जाती है।
हैंडलर जोड़ना संभव है, और इन हैंडलर को निष्पादित किया जा रहा है। क्या आप यह देखने के लिए डीबग नहीं कर सकते कि और क्या हो रहा है? यह एक सार तत्व हो सकता है जो अन्य तत्वों के लिए अधिक उपयोगी हो सकता है :) – EricG
उत्कृष्ट सुझाव। मैं अभी भी Magento के लिए डीबग करने के लिए एक कुशल तरीका पता लगा रहा हूँ और सुझावों के लिए खुला हूँ। सार के रूप में, यह समझ में आता है। क्या हो रहा है इसके लिए कदम भी सराहना की जाएगी। :) – MSD
Google क्रोम में एक उत्कृष्ट डीबगर है। इंस्पेक्टर (Ctrl-Shift-J) खोलें और स्रोतों पर जाएं। आप वहां सभी स्रोतों में खोजने के लिए Ctrl-Shift-F का उपयोग कर सकते हैं। या मैन्युअल रूप से src खोलें, और ब्रेकपॉइंट डालें। फिर इसके माध्यम से कदम :) – EricG