I have installed a custom extension that I have purchased from magento extensions. The module displays above the add to cart button on the product page, inside the column on the right hand side. I would like to move the new extension underneath the image and cart options, out of the right hand side. I am a beginner magento developer, I can not figure out how to move this extensions position on the page. I have created custom blocks before and positioned those in different places but I cant seem to find how the extension asks to be positioned.
I am using magento 1.9
Please can somebody point me in the right direction for which file will hold the call for the page position
== == == == UPDATE == == == ==
Ok within app/code/local/BS/Carpet/etc/config.xml I have the following:
<?xml version="1.0"?>
1.0.5 standard BS_Carpet carpet
<translate>
<modules>
<BS_Carpet>
<files>
<default>BS_Carpet.csv</default>
</files>
</BS_Carpet>
</modules>
</translate>
<events>
<core_block_abstract_to_html_before>
<observers>
<carpetpricetemplate>
<type>model</type>
<class>carpet/observer</class>
<method>changeTemplate</method>
</carpetpricetemplate>
</observers>
</core_block_abstract_to_html_before>
<sales_convert_quote_item_to_order_item>
<observers>
<carpetcustomoptions>
<type>model</type>
<class>carpet/observer</class>
<method>salesConvertQuoteItemToOrderItem</method>
</carpetcustomoptions>
</observers>
</sales_convert_quote_item_to_order_item>
<sales_quote_item_set_product>
<observers>
<carpetsetprice>
<class>carpet/observer</class>
<method>quoteItemSetProduct</method>
</carpetsetprice>
</observers>
</sales_quote_item_set_product>
</events>
</frontend>
<admin>
<routers>
<carpet>
<use>admin</use>
<args>
<module>BS_Carpet</module>
<frontName>carpet</frontName>
</args>
</carpet>
</routers>
</admin>
<adminhtml>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<BS_Carpet>
<title>Carpet Module</title>
<sort_order>10</sort_order>
</BS_Carpet>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<carpet>
<file>carpet.xml</file>
</carpet>
</updates>
</layout>
</adminhtml>
<global>
<models>
<carpet>
<class>BS_Carpet_Model</class>
<resourceModel>carpet_mysql4</resourceModel>
</carpet>
<carpet_mysql4>
<class>BS_Carpet_Model_Mysql4</class>
</carpet_mysql4>
</models>
<resources>
<carpet_setup>
<setup>
<module>BS_Carpet</module>
<class>BS_Carpet_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</carpet_setup>
<carpet_write>
<connection>
<use>core_write</use>
</connection>
</carpet_write>
<carpet_read>
<connection>
<use>core_read</use>
</connection>
</carpet_read>
</resources>
<blocks>
<carpet>
<class>BS_Carpet_Block</class>
</carpet>
</blocks>
<helpers>
<carpet>
<class>BS_Carpet_Helper</class>
</carpet>
</helpers>
</global>
<default>
<bs_carpet>
<general><active>1</active></general>
<general><width>Width</width></general>
<general><length>Length</length></general>
</bs_carpet>
</default>
== == == == UPDATE 2 == == == ==
<?php
class BS_Carpet_Model_Observer {
/**
* Add additional options to order item product options (this is missing in the core)
*
* @param Varien_Event_Observer $observer
*/
public function salesConvertQuoteItemToOrderItem(Varien_Event_Observer $observer)
{
$quoteItem = $observer->getItem();
if ($additionalOptions = $quoteItem->getOptionByCode('additional_options')) {
$orderItem = $observer->getOrderItem();
$options = $orderItem->getProductOptions();
$options['additional_options'] = unserialize($additionalOptions->getValue());
$orderItem->setProductOptions($options);
}
}
public function changeTemplate(Varien_Event_Observer $observer)
{
$_block = $observer->getBlock();
/*get Block type*/
$_type = $_block->getType();
$template = $_block->getTemplate();
//print_r($_type);
$currentProduct = Mage::registry('current_product');
if($currentProduct){
if($_type == 'page/html_head'){
if($currentProduct->getId() && Mage::getStoreConfigFlag('bs_carpet/general/active')){
$isCarpet = $currentProduct->getIsCarpetProduct();
if($isCarpet){
$_block->addItem('skin_css','css/carpet/style.css');
}
}
}
if($_type == 'catalog/product_view' && strpos($template,'options/wrapper.')){
if($currentProduct->getId() && Mage::getStoreConfigFlag('bs_carpet/general/active')){
$isCarpet = $currentProduct->getIsCarpetProduct();
if($isCarpet){
$_child = clone $_block;
$_child->setType('catalog/product_view');
$_child->setTemplate('carpet/calc.phtml');
$_block->append($_child);
}
}
}
if($_type == 'catalog/product_view' && strpos($template,'wrapper/bottom')){
if($currentProduct->getId() && Mage::getStoreConfigFlag('bs_carpet/general/active')){
$isCarpet = $currentProduct->getIsCarpetProduct();
if($isCarpet){
$_child = clone $_block;
$_child->setType('catalog/product_view');
$_child->setTemplate('carpet/init.phtml');
$_block->append($_child);
}
}
}
}
}
public function quoteItemSetProduct($observer) {
$quoteItem = $observer->getEvent()->getQuoteItem();
if (!$quoteItem || !$quoteItem->getProductId() || !$quoteItem->getQuote() || $quoteItem->getQuote()->getIsSuperMode()) return $this;
$product = $observer->getEvent()->getProduct();
$productId = $quoteItem->getProduct()->getId();
$_product = Mage::getModel('catalog/product')->load($productId);
$widthTitle = strtolower(Mage::getStoreConfig('bs_carpet/general/width'));
if($widthTitle == '') {$widthTitle = 'width';}
$lengthTitle = strtolower(Mage::getStoreConfig('bs_carpet/general/length'));
if($lengthTitle == '') {$lengthTitle = 'length';}
$finalPrice = $product->getFinalPrice();
$basePrice = $finalPrice;
$multi = 1;
$width = 0;
$length = 0;
$optionPrice = 0;
if($_product->getIsCarpetProduct()==1){
// prepare post data
$post = $quoteItem->getProduct()->getCustomOption('info_buyRequest')->getValue();
if ($post) $post = unserialize ($post); else $post = array();
if (isset($post['options'])) $options = $post['options']; else $options = false;
if ($options) {
$optionsWeight = 0;
foreach ($options as $optionId => $option) {
$productOption = Mage::getModel('catalog/product_option')->load($optionId);
$_option = $product->getOptionById($optionId);
//Mage::log($_option->getTitle());
$confItemOption = $product->getCustomOption('option_'.$_option->getId());
$value = $confItemOption->getValue();
//$optionValueModel = Mage::getModel('catalog/product_option_value')->load($value);
$group = $_option->groupFactory($_option->getType())
->setOption($_option)
->setConfigurationItemOption($confItemOption);
if(strtolower($_option->getTitle())==$lengthTitle){
if($_option->getType() == 'drop_down'){
$length = (float)$group->getFormattedOptionValue($confItemOption->getValue());
}else {
$length = (float)$confItemOption->getValue();
}
}else if(strtolower($_option->getTitle())==$widthTitle){
if($_option->getType() == 'drop_down'){
$width = (float)$group->getFormattedOptionValue($confItemOption->getValue());
}else {
$width = (float)$confItemOption->getValue();
}
}
$optionPrice += $group->getOptionPrice($confItemOption->getValue(), $basePrice);
}
$dimenion = $width * $length;
$tierPrice = $this->getTierPrice($dimenion, $product);
if(is_array($tierPrice)){
$tierPrice = $finalPrice;
}
if($tierPrice > $finalPrice){
$tierPrice = $finalPrice;
}
$totalPrice = $dimenion * ($tierPrice + $optionPrice);
$quoteItem->setCustomPrice($totalPrice);
$quoteItem->setOriginalCustomPrice($totalPrice);
}
}
return $this;
}
public function getTierPrice($qty = null, $product)
{
$allGroups = Mage_Customer_Model_Group::CUST_GROUP_ALL;
$prices = $product->getData('tier_price');
if (is_null($prices)) {
$attribute = $product->getResource()->getAttribute('tier_price');
if ($attribute) {
$attribute->getBackend()->afterLoad($product);
$prices = $product->getData('tier_price');
}
}
if (is_null($prices) || !is_array($prices)) {
if (!is_null($qty)) {
return $product->getPrice();
}
return array(array(
'price' => $product->getPrice(),
'website_price' => $product->getPrice(),
'price_qty' => 1,
'cust_group' => $allGroups,
));
}
$custGroup = $this->_getCustomerGroupId($product);
if ($qty) {
$prevQty = 1;
$prevPrice = $product->getPrice();
$prevGroup = $allGroups;
foreach ($prices as $price) {
if ($price['cust_group']!=$custGroup && $price['cust_group']!=$allGroups) {
// tier not for current customer group nor is for all groups
continue;
}
if ($qty < $price['price_qty']) {
// tier is higher than product qty
continue;
}
if ($price['price_qty'] < $prevQty) {
// higher tier qty already found
continue;
}
if ($price['price_qty'] == $prevQty && $prevGroup != $allGroups && $price['cust_group'] == $allGroups) {
// found tier qty is same as current tier qty but current tier group is ALL_GROUPS
continue;
}
if ($price['website_price'] < $prevPrice) {
$prevPrice = $price['website_price'];
$prevQty = $price['price_qty'];
$prevGroup = $price['cust_group'];
}
}
return $prevPrice;
} else {
$qtyCache = array();
foreach ($prices as $i => $price) {
if ($price['cust_group'] != $custGroup && $price['cust_group'] != $allGroups) {
unset($prices[$i]);
} else if (isset($qtyCache[$price['price_qty']])) {
$j = $qtyCache[$price['price_qty']];
if ($prices[$j]['website_price'] > $price['website_price']) {
unset($prices[$j]);
$qtyCache[$price['price_qty']] = $i;
} else {
unset($prices[$i]);
}
} else {
$qtyCache[$price['price_qty']] = $i;
}
}
}
return ($prices) ? $prices : array();
}
protected function _getCustomerGroupId($product)
{
if ($product->getCustomerGroupId()) {
return $product->getCustomerGroupId();
}
return Mage::getSingleton('customer/session')->getCustomerGroupId();
}
}