Jump to content

mardon

Members
  • Posts

    189
  • Joined

  • Last visited

Posts posted by mardon

  1. Na  localhostu zkouším upgrade z presty 1.4.0.13 na nejnovější verzi 1.6.0.14. Upgrade proběhl v pořádku, ale mám problém se zobrazením v defaultní šabloně. Např. nezobrazují se mi doporučené produkty na homepage, přesto že model ja aktivován. Domnívám se že problém bude někde v zavěšení modulu. Takto se mi nezobazuje např. ani menu. Lze nějak najednou zavěsit všechny použité moduly v šabloně, nebo musím jednotlivé moduly procházet a nastavovat?

  2. I want use own php script fo adding product to shop, i use

    $product = new Product();
    $product->ean13 = 9999999999999;
    $product->name = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'Test importu');;
    $product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'test-importu');
    $product->id_category = 2;
    $product->id_category_default = 2;
    $product->redirect_type = '404';
    $product->price = 22;
    $product->quantity = 1;
    $product->minimal_quantity = 1;
    $product->show_price = 1;
    $product->on_sale = 0;
    $product->online_only = 1;
    $product->meta_keywords = 'test';
    $product->is_virtual=1;
    $product->add();
    $product->addToCategories(array(2));
    $id_product = $product->id;
    $url = 'http://demo-simpliashop-cz.ecdn.cz/img/mini/4.jpg';
    $shops = Shop::getShops(true, null, true);    
    $image = new Image();
    $image->id_product = $id_product;
    $image->position = Image::getHighestPosition($id_product) + 1;
    $image->cover = true; // or false;
    if (($image->validateFields(false, true)) === true &&
    ($image->validateFieldsLang(false, true)) === true && $image->add())
    {
        $image->associateTo($shops);
        if (!AdminImportController::copyImg($id_product, $image->id, $url, 'products', false))
        {
            $image->delete();
        }
    

    but this produce error: Call to

    protected method AdminImportControllerCore::copyImg() from context

     

    How can i use AdminController in my script

  3. it is possible to create new product by php code (program)

     

    $product = new Product();

    $product->ean13 = 9999999999999;

    $product->name = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'Test importu');;

    $product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') =>  'test-importu');

    $product->id_category = 2;

    $product->id_category_default = 2;

    $product->redirect_type = '404';

    $product->price = 22;

    $product->quantity = 1;

    $product->minimal_quantity = 1;

    $product->show_price = 1;

    $product->on_sale = 0;

    $product->online_only = 1;

    $product->meta_keywords = 'test';

    $product->is_virtual=1;

    $product->add();

    $product->addToCategories(array(2));

     

    $shops = Shop::getShops(true, null, true);    

    $image = new Image();

    $image->id_product = $id_product;

    $image->position = Image::getHighestPosition($id_product) + 1;

    $image->cover = true; // or false;

    if (($image->validateFields(false, true)) === true &&

    ($image->validateFieldsLang(false, true)) === true && $image->add())

    {

        $image->associateTo($shops);

        if (!AdminImportController::copyImg($id_product, $image->id, $url, 'products', false))

        {

            $image->delete();

        }

    }

     

    Hi and its possible create this way a product with specific product_id?

    When i run this script I obtain error : Call to protected method AdminImportControllerCore::copyImg() from context

  4. Hi,

     

    I wrote my own script for import products from xml. I have a fucntion for addimage from xml

    function addImage($id_product,$file,$cover,$position)
    {
        $flag = Db::getInstance()->insert('image',array(
            'id_product' => $id_product,
            'position'=> $position,
            'cover' => $cover
        ));
    
        $id_image = Db::getInstance()->Insert_ID();
    
        $flag = Db::getInstance()->insert('image_lang', array(
            'id_image' => $id_image,
            'id_lang' => 1,
            'legend' => 'test'
        ));
    
        $flag = Db::getInstance()->insert('image_shop', array(
            'id_image' => $id_image,
            'id_shop' => 1,
            'cover' => $cover
        ));
    
    
        $imagesTypes = ImageType::getImagesTypes('products');
    
        $id_image = Db::getInstance()->Insert_ID();
        $path_d = _PS_IMG_DIR_.'p/'.$id_image;
        $path = _PS_IMG_DIR_.'p/'.$id_image.'/'.$id_image.'.jpg';
        mkdir($path_d);
                          
        $data = file_get_contents($file);   
        $fp = fopen($path, 'w');
        fwrite($fp, $data);
        fclose($fp);
    
        $sourceFile['tmp_name']= $path;
        
            foreach ($imagesTypes AS $k => $imageType)
            {
                if (!ImageManager::resize
                (
                 $sourceFile['tmp_name'],
                _PS_IMG_DIR_.'p/'.$id_image.'/'.$id_image.'-'.stripslashes($imageType['name']).'.jpg',
                $imageType['width'],
                $imageType['height']
                )
                ) echo "Chyba IMG ".$file."<br />";
            }
    }
    

    after that import i have apropriate values in database tables, but in FO and although BO I cannot seen images, although in BO I see number of images for product, but images are not display. Where is problem in my function?

  5. It seems I find the problem

     

    before I have this SQL

        $sql = 'SELECT c.id_category FROM '._DB_PREFIX_.'category_lang cl, '._DB_PREFIX_.'category c WHERE c.id_category = cl.id_category AND cl.name="'.$name.'" AND c.level_depth='.($level_depth).' AND cl.id_lang = '.$lang.';';
        $res = mysql_query($sql);
        if (mysql_num_rows($res)>0)
        {
            echo 'Kategorie '.$name.' jiz existuje'."<br />";
            return true;
        } else
        {
            echo 'Kategorie '.$name.' neni v systemu'."<br />";
            return false;
        }
    

    when I changeid to

     $sql = 'SELECT c.id_category FROM '._DB_PREFIX_.'category_lang cl, '._DB_PREFIX_.'category c WHERE c.id_category = cl.id_category AND cl.name="'.$name.'" AND c.level_depth='.($level_depth).' AND cl.id_lang = '.$lang.';'
        Db::getInstance()->ExecuteS($sql);
        $num_rows = Db::getInstance()->NumRows();
        if ($num_rows>0)
        {
            echo 'Kategorie '.$name.' jiz existuje'."<br />";
            return true;
        } else
        {
            echo 'Kategorie '.$name.' neni v systemu'."<br />";
            return false;
        }
    

    now is everything ok

  6. maybe is thata problem?

    Fatal error: Uncaught Cannot execute queries while other unbuffered queries are activUne. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.<br /><br /><pre>UPDATE ps_category c, ps_category_lang cl SET date_upd = now() WHERE c.id_category = cl.id_category AND cl.name = "Elektronická cigareta" AND cl.id_lang = 1 AND c.level_depth = 2;</pre> thrown in D:\web\ps16\classes\db\Db.php on line 635
    
  7. Hi all,

     

    I am trying to write owm php script from importing data from xml file.

     

    I have function

    
    
    function updateCategory ($name, $level_depth, $lang)
    {
        echo 'UPDATE Kategorie '.$name."<br />";
        $sql = 'UPDATE '._DB_PREFIX_.'category c, '._DB_PREFIX_.'category_lang cl SET date_upd = now() WHERE c.id_category = cl.id_category AND cl.name = "'.$name.'" AND cl.id_lang = '.$lang.' AND c.level_depth = '.$level_depth.';';
        $flag = Db::getInstance()->execute($sql);
        if ( !$flag ) echo "Chyba pri Update category: ".$name."<br />";
    }

    execute sql produce error, when I am using the sql command from phpmyadmin is ok, but in script produce error even when i see in database the date_upd is changed to now

  8. Hi,

     

    on localhost i have copy my real e-shop 1.4.3 prestahop version. I try upgrade to 1.6.0.9 with 1-clic upgrade module and evertyhing semms to be ok. But now whem I trying install any module and clic to proceed to intall (in warnin that i have no original module) nothing else hapen. where may i have problem install 3-part module?

     

    Edit: module installation is succesfull but long time about (2 min.)

  9. Uvažuji o upgradu svého e-shopu na nejnovější verzi, s tím , že bychom nasadili responzivní design. Vybrala jsem si hezké téma z themeforest, ale mám problém s tím, že podporuje IE9 a výše. Co jsem koukala do GA, máme ještě nějaké zákazníky, kteří používají IE8. Řešili jste někdo podobný problém? Používáte responzivní design a projevilo se to nějak na úspěšnosti? Díky předem za vaše postřehy  :)

  10. Hi all,

     

    I upgrade my e-shop in Czech languge from 1.4.3 to 1.6.0.8 by 1-click upgade. But i have admin menu in english even if i import czech localization. If i install clean 1.6.0.8 i see admin menu in Czech language. Where is problem in my upgradeed e-shop?

     

    I see in db the table ps_tab_lang isnit translate to czech language. I detect in my shop in ps_lang table i have 21 records and czech is with id 10 and is active. In clean install of 1.6 i saw in ps_lang only Czech language and have id 1. It seems to be problem my shop is started at version 1.0.0.8 and i even upgrade to new version. How is best solution for repair the problem?

     

    I solve this problem

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More