Magento Module: Bushwerp

A custom ERP integration stringing together several platforms for a hunting equipment retailer.

Details

This project had many unique requirements. Starting from a baseline RetailOps integration for Magento, I was also tasked with integrating other third-party extensions. Some unique requirements included:

Screenshots

N/A

Technical Features

N/A

Code Sample

public function getDeliveryEstimate(Mage_Catalog_Model_Product $product)
{
    if (!$this->isDeliveryEstimateEnabled()) {
        return new Varien_Object(
            array(
                'days'          => 0,
                'estimate_text' => '',
            )
        );
    }

    if ( !($result = $this->_getDeliveryEstimateCache($product->getId())) ) {
        $result = new Varien_Object();

        $this->_deliveryEstimateCache[$product->getId()] = $result;
        // Attempt to load the attribute if not detected
        if (!$product->hasData(self::ESTIMATED_DAYS_ATTRIBUTE)) {
            $product->setData(
                self::ESTIMATED_DAYS_ATTRIBUTE,
                Mage::getResourceSingleton('catalog/product')->getAttributeRawValue(
                    $product->getId(),
                    self::ESTIMATED_DAYS_ATTRIBUTE,
                    $product->getStoreId()
                )
            );
        }

        $days = (int) $product->getData(self::ESTIMATED_DAYS_ATTRIBUTE);

        $result->addData(
            array(
                'days'          => $days,
                'estimate_text' => $this->getDeliveryEstimateText($days),
            )
        );
    }

    return $result;
}

Static Analysis