Jump to content

help with php to create product


Santori

Recommended Posts

Hello:

I have created a php script to create products directly by script.

I have problems with some features and I need a little help.

I have four languages and a default lang wich is spanish, i need to send specifically the name od the product into spanish and portuguese, the id lang of portuguese is 4;

$nameesp = $_POST['nombre'];
$product->name = [$default_lang => $nameesp];
$namept = $_POST['nombrept'];
$product->name??? = [$???? => $namept];

Any suggestion?

Link to comment
Share on other sites

Hello:

You should fill all language related fields in all languages of your shop. Something like this:

$prod = new Product();
foreach (Language::getLanguages(false) as $lang) {
	$prod->name[$lang['id_lang']] = 'Product name';
}
$prod->add();

Regards

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...