View Single Post
  #1  
Old 07-20-2017, 03:31 AM
 
ajeetsingh ajeetsingh is offline
 

Member
  
Join Date: Dec 2016
Posts: 28
 

Default Argument 1 passed to must be an instance of ...\..\, string given

Hello Anyone,

I have some issue in xcart 5.3.3.1 version to develop a module like pre order.

My code in preorder.php file are as below:

PHP Code:
public function getPreOrder(\XLite\Core\CommonCell $cnd null$value false)
{
   
$queryBuilder $this->createQueryBuilder('v');
   
$this->currentSearchCnd $cnd;       

   return 
$this->getPreorderItem($queryBuilder$value);


And that function is calling in another file name AddButton.php place as below:

PHP Code:
protected function getDefaultTemplate() {              
      
$product_id = \XLite\Core\Request::getInstance()->getData()['product_id'];       
      
$preorder_details = \XLite\Core\Database::getRepo('XLite\Module\Webkulsoftware\PreorderSales\Model\Preorders')->getPreOrder('',$product_id);
      
     if(
$preorder_details[0]->enabled)
        return 
'modules/Webkulsoftware/PreorderSales/add_button/body.twig';
      else
        return 
'product/add_button/body.twig';
    } 


And when i run that code the found an error on front-end product details page as below:

Argument 1 passed to XLite\Module\Webkulsoftware\PreorderSales\Model\Re po\Preorders::getPreOrder() must be an instance of XLite\Core\CommonCell, string given, called in /home/users/ajeetsingh/www/html/xcart5331/var/run/classes/XLite/Module/Webkulsoftware/PreorderSales/View/Product/Details/Customer/AddButton.php


So, Can any one suggest me that what i do wrong.I am waiting for a valuable suggestion.
__________________
Ajeet Singh
Sr.Software Developer
Webkul Software Pvt. Ltd.
Reply With Quote