Error in checkout/onepage after Magento patch 6788 - php

I am a newbie in the Magento programming and I have the following problem:
When I applied the Magento Patch 6788 I can't reach the www.siteurl.com/checkout/onepage/ anymore.
I think it has something to do with the following:
<?php
class MW_Ddate_Model_Ddate extends Mage_Core_Model_Abstract
{
private $inexedDdates = null;
public function _construct()
{
parent::_construct();
$this->_init('ddate/ddate');
}
public function getNumberOrderFromNow() {
if(is_null($this->inexedDdates)) {
$timeFilter = strtotime('- 1 day');
$collection = $this->getCollection()
->addFieldToFilter('UNIX_TIMESTAMP(ddate)', array('gteq' => $timeFilter));
$ddateArray = array();
foreach ($collection as $ddate) {
$ddateArray[$ddate->getDtime()][$ddate->getDdate()] = $ddate;
}
$this->inexedDdates = $ddateArray;
}
return $this->inexedDdates;
}
}
?>
In the logfile there was something said about ->addFieldToFilter('UNIX_TIMESTAMP(ddate)'
I think the UNIX_TIMESTAMP is deprecated when I did the patch.
Does anyone knows how I can solve this problem?
EDIT:
The plugin which I use on the onepage is the Delivery Date from MageWorld

Contact MageWorld and ask them? If they don't support it anymore; test the module with SUPEE-6788 developer toolbox. The toolbox can also fix compatibility issues with modules and the SUPEE-6788 patch. Also have a look at the technical details of the SUPEE-6788 patch at the "APPSEC-1063, addressing possible SQL injection" section.

Related

How set module view for custom searcher in prestashop 1.6

I'm trying to integrate Fotolia Api with Prestashop 1.6.0.9.
I already make module with custom tab, but I have no idea how set view from module folder for this tab. Sorry to say, but "documentation for developers" SUCKS.
I can't find any working solution.
public function install() {
if (!parent::install()
|| !$this->registerHook('backOfficeHeader')
|| !$this->registerHook('header')
) return false;
$tab = new Tab();
$tab->class_name = 'AdminFotoliaSelector';
$tab->id_parent = 0;
$tab->module = $this->name;
$tab->name[(int)(Configuration::get('PS_LANG_DEFAULT'))] = 'Fotolia Selector';
$tab->add();
return true;
}
I had big problem with make proper controller, and now I just can't load anything/ I have no idea how do this.
<?php
if (!defined('_PS_VERSION_'))
exit;
class AdminFotoliaSelectorController extends ModuleAdminController {
public $name;
public function __construct() {
$this->lang = (!isset($this->context->cookie) || !is_object($this->context->cookie)) ? intval(Configuration::get('PS_LANG_DEFAULT')) : intval($this->context->cookie->id_lang);
parent::__construct();
}
public function initContent() {
parent::initContent();
$this->renderForm();
}
public function renderForm() {
$path = _MODULE_DIR_."fotoliaselector";
$more = $this->module->display($path, 'views/templates/admin/fotoliaselector.tpl');
return $more.parent::renderForm();
}
When I try die($more) it gives me content of .tpl, anyway when I click tab in back office it's still empty.
I have debug options on, compiling on, cache off.
So just enlight me please, how am I supose to show ANYTHING there?
I think the problem is that you don't display tab's content at all.
I don't know what module->display method does, but I think you should change in initContent() method line:
$this->renderForm();
into
echo $this->renderForm();
If it won't help you should look at this documentation and try to do it without external classes - only try to use Smarty to display simple content without using Tab class or AdminFotoliaSelector
Well i know it will sounds weird but you need to take some similar modules, and read his code and will see some methods names are the same in each module.
Then copy that, install and play with some changes etc.
Imho you miss standard method getContent() form where you need to pass some data for smarty:
public function getContent()
{
global $smarty, $cookie;
......
//some code
......
$this->_html .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>';
$this->_html .= '<h1>My module title or stuff</h1>';
$this->_html .= $this->getMyCoolFormOrConfig();
$smarty->assign('errors', $this->errors);
$smarty->assign('message', $this->message);
$this->_html .= $this->display(__FILE__, 'name_of_tpl_file.tpl');
return $this->_html;
}
to simple add tab in BackOffice code like this:
$id_tab=Tab::getIdFromClassName('AdminPayment');
$newtab=new Tab();
$newtab->id_parent=$id_tab;
$newtab->module=$this->name;
$newtab->class_name='MyClassName'; //will be same like MyClassName.php in folder of you module where you need to create you class and extend the AdminTab and from there with function you need to echo you name module
$newtab->position=Tab::getNbTabs($id_tab)+1;
$newtab->name[$cookie->id_lang]=$this->l("Name of you stuff");
$newtab->name[Configuration::get('PS_LANG_DEFAULT')]=$this->l("Name of you stuff");
$newtab->add();
Study this file there /controllers/admin/AdminModulesController.php
and you see what methods are using in each module
Take a look greater feature to generate you module structure (register requeired) https://validator.prestashop.com/generator

Fatal error: Class 'Zend_Log' not found

I'm getting the following error in magento administration
Fatal error: Class 'Zend_Log' not found in /home/website/public_html/app/code/community/Uni/Fileuploader/Block/Adminhtml/Fileuploader/Edit/Tab/Products.php on line 241
This is a community extension, which has been working fine on my website. The error makes no sense to me, because the line 241 contains just a closing "}" character.
class Uni_Fileuploader_Block_Adminhtml_Fileuploader_Edit_Tab_Products extends Mage_Adminhtml_Block_Widget_Grid {
...
...
...
public function getRowUrl() {
return '#';
}
public function getGridUrl() {
return $this->getUrl('*/*/productgrid', array('_current' => true));
}
protected function getFileuploaderData() {
return Mage::registry('fileuploader_data');
}
protected function _getSelectedProducts() {
$products = $this->getRequest()->getPost('selected_products');
if (is_null($products)) {
$products = explode(',', $this->getFileuploaderData()->getProductIds());
return (sizeof($products) > 0 ? $products : 0);
}
return $products;
}
} // line 241, where error occurs
I can post the rest of the code, if you need it.
I noticed that if I upgrade to PHP 5.4 version the error disappears, but since 5.4 version causes other errors on my website, I have to continue using 5.3.
Any ideas on how to solve this?
The problem could be the name of one of the methods in your custom class.
Take for example the method name is getData() ,
Try searching for generic method names in your script, such as getData, which might be reserved by some of Magento’s core classes. I figure that these methods have predefined functionality, which your module is missing support for, and Zend then tries to write an exception to Zend log.
Reference link: netismine
I got the same error when rewriting a payment method.
public function authorize($payment, $amount)
Solved rewriting exactly the same main method:
public function authorize(Varien_Object $payment, $amount)
Magento 1.9.1.0/PHP 5.5

Fatal error in joomla component

i just installed a new component in my site but when i click on component settings button in the backend i am getting this message:
Fatal error: Call to a member function loadByOption() on a non-object in /mysite.com/administrator/components/com_sigpro/models/settings.php on line 32
the file contains this code:
defined('_JEXEC') or die ;
class SigProModelSettings extends SigProModel
{
protected $extensionID = null;
public function getForm()
{
$option = $this->getState('option');
if (version_compare(JVERSION, '2.5.0', 'ge'))
{
$component = JComponentHelper::getComponent($option);
$this->extensionID = $component->id;
JForm::addFormPath(JPATH_ADMINISTRATOR.'/components/'.$option);
$form = JForm::getInstance($option.'.settings', 'config', array('control' => 'jform'), false, '/config');
$form->bind($component->params);
}
else
{
$component = JTable::getInstance('component');
$component->loadByOption($option);
$this->extensionID = $component->id;
$form = new JParameter($component->params, JPATH_ADMINISTRATOR.DS.'components'.DS.$option.DS.'config.xml');
}
return $form;
}
PS my site is running Joomla 1.7.5 stable version and i cant upgrade it to 2.5 because the site is online and productive some components dont works on version 2.5 .
So i will appreciate it if someone can help me fix this error.
Thanks in advance
you 1.6 needs 1.6 specific modules, components & plugins. You'll need to find a 1.6 compatible version or alternative or check the permissions on /configuration.php
Looks like the table class is not present in your file system. It should have been there in the /mysite.com/administrator/components/com_sigpro/tables folder , somewhere ( may vary depending on the code, but looks like they have not included a custom path ). The class should extends JTable class.

What replaces get_course_category_tree() in Moodle 2.5?

I've followed a Tutorial on Moodle.org on how to extend the custom menu and I'm receiving this error message in Moodle 2.5:
Function get_course_category_tree() is deprecated, please use course renderer or coursecat class, see function phpdocs for more info
The code works, but I would like to upgrade the code for Moodle 2.5. I've found documentation on replacement functions.
Below is the code directly from the tutorial. I need to replace get_category_tree().
class theme_mytheme_core_renderer extends core_renderer {
protected function render_custom_menu(custom_menu $menu) {
global $CFG;
require_once($CFG->dirroot.'/course/lib.php');
$branch = $menu->add(get_string('courses', 'theme_mytheme'), null, null, 10000);
$categorytree = get_course_category_tree();
foreach ($categorytree as $category) {
$this->add_category_to_custommenu($branch, $category);
}
return parent::render_custom_menu($menu);
}
}
Here is the documentation for the new functions. I've tried all three of the following functions with no success. Does anyone have any thoughts or pointers?
core_course_renderer::coursecat_coursebox()
core_course_renderer::coursecat_courses()
core_course_renderer::coursecat_tree()
You can use $courses = get_courses($categoryid) to get the result.

Magento 1.4 Load By Category Not Working

I have a Magento helper class I wrote that works wonderfully in 1.3. However, we're working on a new install of 1.4 and filtering by category won't work for some reason.
function __construct()
{
Mage::app();
$this->model = Mage::getModel('catalog/product');
$this->collection = $this->model->getCollection();
$this->collection->addAttributeToFilter('status', 1);//enabled
$this->collection->addAttributeToSelect('*');
}
function filterByCategoryID($catID)
{
$this->collection->addCategoryFilter(Mage::getModel('catalog/category')->load($catID));
}
I can't figure out why this isn't working in 1.4. Has anyone else come into this issue?
Based on what you posted, my guess would be there's something else in your code that's adding/removing filters to/from your collection. I ran the following code on a 1.4 install
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToFilter('status', 1)
->addCategoryFilter(Mage::getModel('catalog/category')->load(8))
->addAttributeToSelect('*');
and the product collection was filtered as expected.
Expanding your question to show how you're using your helper and what you expect it to do vs what it does would help.
I was able to get it working with the code below...
function __construct()
{
Mage::app();
}
function filterByCategoryID($catID)
{
//$this->collection->addCategoryFilter(Mage::getModel('catalog/category')->load($catID));
$this->collection = Mage::getModel('catalog/category')->load($catID);
}

Categories