Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Class not found

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-24-2015, 04:53 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Class not found

I'm working on a new module to add radio buttons as product option attributes. I created a class called Radio but xcart is not finding it. I keep getting the following error


[24-Mar-2015 09:43:41 America/Indiana/Indianapolis] PHP Fatal error: Class '\XLite\View\Product\AttributeValue\Admin\Radio' not found in /home/upflushi/www/var/run/classes/XLite/View/AViewAbstract.php on line 418
[24-Mar-2015 09:43:41] Error (code: 1): Class '\XLite\View\Product\AttributeValue\Admin\Radio' not found
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=product&product_id=1&page=attribu tes;
Backtrace:
#0 Includes\ErrorHandler::logInfo(Class '\XLite\View\Product\AttributeValue\Admin\Radio' not found, 1) called at [/home/upflushi/www/Includes/ErrorHandler.php:324]
#1 Includes\ErrorHandler::handleError(Array ([type] => 1,[message] => Class '\XLite\View\Product\AttributeValue\Admin\Radio' not found,[file] => /home/upflushi/www/var/run/classes/XLite/View/AViewAbstract.php,[line] => 41) called at [/home/upflushi/www/Includes/ErrorHandler.php:309]
#2 Includes\ErrorHandler::shutdown()


The xlite.log contained



Mar 24 09:57:59 XLite [warning] Warning: include_once(/home/upflushi/www/var/run/classes/XLite/Model/AttributeValue/AttributeValueRadio.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/upflushi/www/Includes/Autoloader.php on line 125
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=product&product_id=1&page=attribu tes;
Mar 24 09:57:59 XLite [warning] Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '/home/upflushi/www/var/run/classes/XLite/Model/AttributeValue/AttributeValueRadio.php' for inclusion (include_path='.:/usr/local/lib/php:/home/upflushi/www/lib/') in /home/upflushi/www/Includes/Autoloader.php on line 125
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=product&product_id=1&page=attribu tes;
Mar 24 09:57:59 XLite [warning] Warning: include_once(/home/upflushi/www/var/run/classes/XLite/View/Product/AttributeValue/Admin/Radio.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/upflushi/www/Includes/Autoloader.php on line 125
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=product&product_id=1&page=attribu tes;
Mar 24 09:57:59 XLite [warning] Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '/home/upflushi/www/var/run/classes/XLite/View/Product/AttributeValue/Admin/Radio.php' for inclusion (include_path='.:/usr/local/lib/php:/home/upflushi/www/lib/') in /home/upflushi/www/Includes/Autoloader.php on line 125
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=product&product_id=1&page=attribu tes;




Any ideas?
__________________
Ver 5.2.6
Reply With Quote
  #2  
Old 03-24-2015, 07:38 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Class not found

Hello Phil,

How did you add the class?
Where is the file with the class definition located?
What is the source code?
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 03-24-2015, 07:56 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Class not found

At the top of your radio.php, what is your namespace?
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #4  
Old 03-24-2015, 08:12 AM
 
Phil Richman Phil Richman is offline
 

Advanced Member
  
Join Date: May 2012
Posts: 94
 

Default Re: Class not found

It is located in:
/classes/XLite/Module/Pmall/RadioButtonOptions/View/Product/AttributeValue/Admin/

PHP Code:
namespace XLite\Module\Pmall\RadioButtonOptions\View\Product\AttributeValue\Admin;
/**
 * Attribute value (Radio)
 */
class Radio extends \XLite\View\Product\AttributeValue\Admin\AAdmin
{
    
/**
     * Get dir
     *
     * @return string
     */
    
protected function getDir()
    {
        return 
parent::getDir() . '/radio';
    }
    
/**
     * Return values
     *
     * @return array
     */
    
protected function getAttrValues()
    {
        
$values $this->getAttrValue();
        if (
$values) {
            
$result = array();
            foreach (
$values as $v) {
                
$result[$v->getId()] = $v;
            }
            unset(
$values);
        } else {
            
$result = array(null);
        }
        
$result['NEW_ID'] = null;
        return 
$result;
    }
    
/**
     * Get attribute type
     *
     * @return string
     */
    
protected function getAttributeType()
    {
        return \
XLite\Model\Attribute::TYPE_RADIO;
    }
    
/**
     * Return name of widget class
     *
     * @return string
     */
    
protected function getWidgetClass()
    {
        return 
$this->getAttribute() && !$this->getAttribute()->getProduct()
            ? 
'\XLite\View\FormField\Input\Text\AttributeOption'
            
'\XLite\View\FormField\Input\Text';
    }
    
/**
     * Return field value
     *
     * @param \XLite\Model\AttributeValue\AttributeValueSelect $attributeValue Attribute value
     *
     * @return mixed
     */
    
protected function getFieldValue($attributeValue)
    {
        return 
$attributeValue && $this->getAttribute() && $this->getAttribute()->getProduct()
            ? 
$attributeValue->getAttributeOption()->getName()
            : 
$attributeValue;
    }
    
/**
     * Get value style
     *
     * @param $id Id
     *
     * @return string
     */
    
protected function getValueStyle($id)
    {
        return 
'line clearfix '
            
. (is_int($id) ? 'value' 'new');
    }

__________________
Ver 5.2.6
Reply With Quote
  #5  
Old 03-25-2015, 01:14 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Class not found

Where and how do you use this class?

Quote:
Class '\XLite\View\Product\AttributeValue\Admin\Radio' not found

Quote:
include_once(/home/upflushi/www/var/run/classes/XLite/Model/AttributeValue/AttributeValueRadio.php

These error messages make me believe that there is an error in the class name somewhere either in your templates, or in other PHP classes that reference the \XLite\Module\Pmall\RadioButtonOptions\View\Produc t\AttributeValue\Admin\Radio class.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #6  
Old 04-03-2015, 05:14 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Class not found

Hello Phil,

I feel you are referring to your new class as to
PHP Code:
\XLite\View\Product\AttributeValue\Admin\Radio 

but you should refer to it as to
PHP Code:
\XLite\Module\Pmall\RadioButtonOptions\View\Product\AttributeValue\Admin 

Please, let me know if it makes sense to you.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:10 AM.

   

 
X-Cart forums © 2001-2020