Jump to content

How To Use Classe Product


imnotcraig

Recommended Posts

Yes, I looked into the source code and I followed the comments.

The problem is when I do:

 

$ p-> name = "Product name";

 

This saves individually "P", "r", "o", .... then it is marked on the comments that the value of the $name is string.

Link to comment
Share on other sites

There's a reason that:

 

$ p-> name = "Product name";

 

Doesn't work, and that's because it should be an array of language strings and not just a string. If you look in the AdminImportController.php file you'll see that these are actually populated using a function:

 

   static function createMultiLangField($field)
   {
       $languages = Language::getLanguages(false);
       $res = array();
       foreach ($languages as $lang)
           $res[$lang['id_lang']] = $field;
       return $res;
   }

 

Use a similar function in your own code and the problem with the name will be fixed. You can see which fields require this by looking at the above admin import file for clues (in later PS1.5 versions the admin "tabs" are in controllers/admin) :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...