22

Since I cannot ask this on the main website because it will not be a question with much value for many readers, I decided to post it here.

What are the funny/useless/strange/... pieces of code you found in Magento so far?
Any version is OK. even 2.0.

I'll start with an old one. From ce-1.1. It can even be older I just couldn't check.

In the file app/design/frontend/default/default/template/checkout/onepage/shipping.phtml there is this on line 41:

<?php if(false): ?>
        <div class="input-box">
        <label for="shipping:email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
        <input type="text" name="shipping[email]" id="shipping:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="validate-email required-entry input-text" /></div>
<?php endif ?>

It was later (1.4 when the default package was changed to base) changed to

<?php if(false): ?>
    <div class="fields">
        <label for="shipping:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
        <div class="input-box">
            <input type="text" name="shipping[email]" id="shipping:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
        </div>
    </div>
<?php endif ?>

You can also see it here for 1.1. and here for 1.4
It was removed much later. In 1.7

Let's see how long can we make the list.

| |

38 Answers 38

1
2
1

The Mage_SalesRule observer follows some weird naming conventions. Actually none at all, each observer method is named completely differen. But this is my highlight:

public function sales_order_afterPlace($observer)

the event is sales_order_place_after. Who understands this logic?

| |
0
$installer->addAttribute('customer', $disableAGCAttributeCode, array(
    'type'      => 'static',
    'label'     => 'Disable Automatic Group Change Based on VAT ID',
    'input'     => 'boolean',
    'backend'   => 'customer/attribute_backend_data_boolean',
    'position'  => 28,
    'required'  => false
));
| |
  • Interesting; was this every fixed in later version update? app/code/core/Mage/Customer/sql/customer_setup/upgrade-1.6.1.0-1.6.2.0.php – snh_nl Mar 17 '16 at 19:37
0

// do not add grops without attributes

app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php

v1.8

| |
0
* Enter description here...

found in Mage_Core_Model_Config_Element :-)

| |
0
// remove this next part when we stop supporting that crap-ass PHP 4.2
| |
  • What file is that? What version? – Marius Nov 19 '14 at 7:52
  • Technically not part of magento I suppose as it's in the pearlib downloader/php/pearcmd.php. I was just looking for colourfull langauge, It seems the developer of external libarys swear more than the Magento ones. e.g calendar.js if (Calendar.is_khtml) setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); else Calendar.continuation_for_the_fucking_khtml_browser(); and in prototpye/window.js sums up IE. // Fucking IE select issue – James Anelay - TheExtensionLab Nov 19 '14 at 9:35
0

I am a Hermit

I don't get any visitor:

class Mage_Adminhtml_SalesController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Additional initialization
     *
     */
    protected function _construct()
    {
        $this->setUsedModuleName('Mage_Sales');
    }

    public function indexAction()
    {
        $this->loadLayout();
        $this->_setActiveMenu('sales');

        $block = $this->getLayout()->createBlock('adminhtml/sales', 'sales');
        $this->_addContent($block);

        $this->_addBreadcrumb($this->__('Sales'), $this->__('Sales'));
        $this->_addBreadcrumb($this->__('Orders'), $this->__('Orders'));
        $this->renderLayout();
    }

    protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('sales');
    }
}

This is my dwelling:

class Mage_Adminhtml_Block_Sales extends Mage_Adminhtml_Block_Template
{
    public function __construct()
    {
        parent::__construct();
        $this->setTemplate('sales/index.phtml');
    }

    public function _beforeToHtml()
    {
        $this->assign('createUrl', $this->getUrl('*/sales/new'));
        $this->setChild('grid', $this->getLayout()->createBlock('adminhtml/sales_grid', 'sales.grid'));
        return parent::_beforeToHtml();
    }
}

sales/index.phtml is an empty cave and adminhtml/sales_grid is a non-entity, which suits me just fine until the day I die.

| |
0

Those __constructs... Those underlines on variables... Those alias non usage... Those @TODO's (* @todo Needs to be reimplemented to get rid of the copypasted methods)

Was Magento 2 really ready for public???

| |
0
 * @method string setFrontendInputRenderer(string $value)
 * @method int setIsGlobal(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsVisible()
 * @method int setIsVisible(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsSearchable()
 * @method int setIsSearchable(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getSearchWeight()
 * @method int setSearchWeight(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsFilterable()
 * @method int setIsFilterable(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsComparable()
 * @method int setIsComparable(int $value)
 * @method int setIsVisibleOnFront(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsHtmlAllowedOnFront()
 * @method int setIsHtmlAllowedOnFront(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsUsedForPriceRules()
 * @method int setIsUsedForPriceRules(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsFilterableInSearch()
 * @method int setIsFilterableInSearch(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getUsedInProductListing()
 * @method int setUsedInProductListing(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getUsedForSortBy()
 * @method int setUsedForSortBy(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsConfigurable()
 * @method int setIsConfigurable(int $value)
 * @method string setApplyTo(string $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsVisibleInAdvancedSearch()
 * @method int setIsVisibleInAdvancedSearch(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getPosition()
 * @method int setPosition(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsWysiwygEnabled()
 * @method int setIsWysiwygEnabled(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsUsedForPromoRules()
 * @method int setIsUsedForPromoRules(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsUsedForCustomerSegment()
 * @method int setIsUsedForCustomerSegment(int $value)
 * @method Mage_Catalog_Model_Resource_Eav_Attribute getIsUsedForTargetRules()
 * @method int setIsUsedForTargetRules(int $value)
| |
1
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .