Jump to content

feof84

Members
  • Content count

    40
  • Joined

  • Last visited

1 Follower

About feof84

  • Rank
    PrestaShop Apprentice
  1. list of products

    Hi Vekia, I thank you for your precious help. I edited the php file like this: if ($n == 0) $n = 10; $category = new Category(60); $productsViewed = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay, false, true, false, 0, true); $nbProducts = sizeof($productsViewed); include('../../pagination.php'); $smarty->assign(array( 'products' => $productsViewed, 'nbProducts' => $nbProducts)); The problem is that in the tpl file you suggested, similar to product_list.php I do not see all the products in the category 60 because after 10 products included in the category with id 60, the tpl file shows me the products that are in the range between 1 and 10. How can I solve the problem? For example, this user has 2 tshirt created, but I can see only one because it is in the range of the first 10 tshirt http://www.mytshirt.name/mytshirt/modules/mymodule/mymodule_page.php?iduser=3 Help me please ?
  2. delete product

    Hi, I wrote a function to launch when I have to delete a product. It 'correct? function delete_product($id_product) { $db = mysql_connect(host, user, password) or die("Connessione non riuscita: " . mysql_error()); mysql_select_db(database, $db) or die ("Impossibile connettersi al database database<br>"); /* elimino il prodotto dalla tab ps_product */ $q = "DELETE FROM `ps_product` WHERE `ps_product`.`id_product`=$id_product"; $result=mysql_query($q); if (!$result) { die('Invalid query: ' . mysql_error()); } /* elimino il prodotto dalla tab ps_category_product */ $q = "DELETE FROM `ps_category_product` WHERE `ps_category_product`.`id_product` =$id_product"; $result=mysql_query($q); if (!$result) { die('Invalid query: ' . mysql_error()); } /* elimino il prodotto dalla tab */ $q = "DELETE FROM `ps_product_lang` WHERE `ps_product_lang`.`id_product` =$id_product"; $result=mysql_query($q); if (!$result) { die('Invalid query: ' . mysql_error()); } /* elimino le immagini associate al prodotto */ $q = "DELETE FROM `ps_image` WHERE `ps_image`.`id_product` =$id_product"; $result=mysql_query($q); if (!$result) { die('Invalid query: ' . mysql_error()); } mysql_close($db); return TRUE; }
  3. id image in file tpl

    yes exactly. you tell me I'm wrong because I use arrays instead of objects. how should I do?
  4. id image in file tpl

    in file php: $product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true); $smarty->assign('products', $product_list ); in file tpl: <h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}"> the link of the product: http://127.0.0.1/mytshirt/modules/mymodule/mymodule_page.php if instead use <a href="{$link->getProductLink($produtct.id_product)}" the link is corret. I still can not see the image of the product
  5. id image in file tpl

    for the same reason why I return an id wrong <h5> <a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">
  6. id image in file tpl

    you're right, then I must call id_image differently in the tpl file? how? thank you
  7. id image in file tpl

    hi, a member of this forum has helped me to write a tpl file, but now I have a problem. In the tpl file I get the image id but the value is always empty. <?php global $smarty; include('../../config/config.inc.php'); include('../../header.php'); $product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true); $smarty->assign('products', $product_list ); $smarty->display(dirname(__FILE__).'/mymodule_page.tpl'); in file tpl: <img src="{$link->getImageLink($product->link_rewrite, $product->id_image, 'home')}" $product->id_image is empty. help me, please!
  8. list of products

    see the output products of category 62, work.
  9. list of products

    are in lower letters. No, is the web editor I change the output :-( :-(
  10. list of products

    hello, I can not display anything, apache logs tell me: [Wed Sep 26 14:37:05 2012] [error] [client 127.0.0.1] PHP Notice: Undefined variable: withBlockLeft in / var / www / mytshirt / tools / smarty / sysplugins / smarty_internal_data.php on line 291 [Wed Sep 26 14:37:05 2012] [error] [client 127.0.0.1] PHP Notice: Undefined variable: withBlockLeft in / var / www / mytshirt / tools / smarty / sysplugins / smarty_internal_data.php on line 291 [Wed Sep 26 14:37:06 2012] [error] [client 127.0.0.1] PHP Notice: Undefined variable: _GET in / var / www / mytshirt / tools / smarty / sysplugins / smarty_internal_data.php on line 291 [Wed Sep 26 14:37:06 2012] [error] [client 127.0.0.1] PHP Notice: Undefined variable: _GET in / var / www / mytshirt / tools / smarty / sysplugins / smarty_internal_data.php on line 291 [Wed Sep 26 14:37:06 2012] [error] [client 127.0.0.1] PHP Notice: Undefined variable: withBlockRight in / var / www / mytshirt / tools / smarty / sysplugins / smarty_internal_data.php on line 291 [Wed Sep 26 14:37:06 2012] [error] [client 127.0.0.1] PHP Notice: Undefined variable: withBlockRight in / var / www / mytshirt / tools / smarty / sysplugins / smarty_internal_data.php on line 291 The module consists of the file: cat mymodule_page.php <? Php global $ smarty; include ('.. /.. / config / config.inc.php'); include ('.. /.. / header.php'); / / $ Smarty-> display (dirname (__FILE__). '/ Mymodule_page.tpl'); / / $ Smarty-> assign ('messageSmarty', "to shareholders"); / / creation of our variable / / $ Smarty-> display (dirname (__FILE__). '/ Mymodule_page2.tpl'); $ Product_list = Product :: getProducts ($ cookie-> id_lang, 0,0, 'id_product', 'ASC', 60, true); $ Smarty-> assign ('products', $ product_list); $ Smarty-> display (dirname (__FILE__). '/ Mymodule_page.tpl'); include ('.. /.. / footer.php'); ?> cat mymodule_page.tpl {Foreach from = $ products item = product name = products} {If $ product.supplier_reference == "$ _GET ['USERIDVARHERE']"} <Li class = "{if $ ajax_block_product smarty.foreach.products.first first_item} {elseif $ smarty.foreach.products.last last_item} {/ if} {if $ smarty.foreach.products.index% 2} {else alternate_item item} {/ if} clearfix "> <div class="center_block"> <A href = "{$ product.link | escape: 'htmlall': 'UTF-8'}" class = "product_img_link" title = "{$ product.name | escape: 'htmlall': 'UTF-8'} "> <img src="{$link-> getImageLink ($ product.link_rewrite, $ product.id_image, 'home')}" alt = "{$ product.legend | escape: 'htmlall': 'UTF-8' } "{if isset ($ homeSize)} width =" {$} homeSize.width "height =" {$ homeSize.height} "{/ if} /> </ a> <h3> {if isset ($ product.new) && $ product.new == 1} {ls = <span class="new"> 'New'} </ span> {/ if} <a href = "{ $ product.link | escape: 'htmlall': 'UTF-8'} " <p class="product_desc"> <a href = "{$ product.link | escape: 'htmlall': 'UTF-8'}" </ Div> <div class="right_block"> {If isset ($ product.on_sale) && $ product.on_sale && isset ($ product.show_price) && $ product.show_price &&! $ PS_CATALOG_MODE <span class="on_sale">} {ls = 'On sale!'} < / span> {Elseif isset ($ product.reduction) && $ product.reduction && isset ($ product.show_price) && $ product.show_price &&! $ PS_CATALOG_MODE <span class="discount">} {ls = 'Reduced price!'} < / span> {/ if} {If isset ($ product.online_only) && $ product.online_only <span class="online_only">} {ls = 'Online only!'} </ Span> {/ if} {If ($ PS_CATALOG_MODE AND ((isset ($ product.show_price) && $ product.show_price) | | (isset ($ product.available_for_order) && $ product.available_for_order)))} <div> {If isset ($ product.show_price) && $ product.show_price &&! Isset ($ restricted_country_mode)} <span style="display: class="price" inline;"> {if! PriceDisplay} {$ price = $ product convertPrice . price} {else} {convertPrice price = $ product.price_tax_exc} {/ if} </ span> /> {/ if} {If isset ($ product.available_for_order) && $ product.available_for_order &&! Isset ($ restricted_country_mode)} <span class="availability"> {if ($ product.allow_oosp | | $ product.quantity> 0)} {ls = 'Available'} {elseif (isset ($ product.quantity_all_versions) && $ product.quantity_all_versions> 0)} {ls = 'Product available with different options'} {else} {ls = 'Out of stock'} {/ if} </ span> {/ if} </ Div> {/ If} {If ($ product.id_product_attribute == 0 | | (isset ($ add_prod_display) && ($ add_prod_display == 1))) && $ product.available_for_order &&! Isset ($ restricted_country_mode) && $ product.minimal_quantity <= 1 && $ product.customizable! = 2 &&! $ PS_CATALOG_MODE} {If ($ product.allow_oosp | | $ product.quantity> 0)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link-> getPageLink ('cart.php')}? add & id_product = {$ product.id_product | intval} {if isset ($ static_token)} & token = {$ static_token} {/ if} "title =" {ls = 'Add to cart'} "> {ls = 'Add to cart'} </ a> {Else} <span class="exclusive"> {ls = 'Add to cart'} </ span> {/ If} {/ If} <a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{ls='View'}"> {ls = 'View'} </ to> {If isset ($ comparator_max_item) && $ comparator_max_item} <p class="compare"> <input type = "checkbox" class = "comparator" id = "{$ comparator_item_ product.id_product}" value = "$ {comparator_item_ product.id_product}" {if isset ($ CompareProducts) && in_array ($ product.id_product, $ CompareProducts)} checked {/ if} /> <label for="comparator_item_{$product.id_product}"> {ls = 'Select to compare'} </ label> </ p> {/ If} </ Div> </ Li> {/ If} {/ Foreach}
  11. list of products

    hello, thank you for your help. Your code is to be entered in a tpl file, but how do I switch? USERIDVARHERE the tpl file? <?php global $smarty; include('../../config/config.inc.php'); include('../../header.php'); $product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true); $smarty->display(dirname(__FILE__).'/mymodule_page.tpl'); include('../../footer.php'); ?> your code is inserted into mymodule_page.tpl but how I make them interact?
  12. list of products

    $product_list = Product::getProducts($cookie->id_lang, 0,0, 'id_product', 'ASC', 60, true); print_r($product_list); Welcome to my shop! cane to patri Array ( [0] => Array ( [id_product] => 816 [id_supplier] => 0 [id_manufacturer] => 0 [id_tax_rules_group] => 0 [id_category_default] => 60 [id_color_default] => 0 [on_sale] => 0 [online_only] => 0 [ean13] => [upc] => [ecotax] => 0.000000 [quantity] => 3520 [minimal_quantity] => 1 [price] => 11.590000 [wholesale_price] => 0.000000 [unity] => [unit_price_ratio] => 0.000000 [additional_shipping_cost] => 0.00 [reference] => reference [supplier_reference] => 72 [location] => [width] => 0 [height] => 0 [depth] => 0 [weight] => 0 [out_of_stock] => 2 [quantity_discount] => 0 [customizable] => 0 [uploadable_files] => 0 [text_fields] => 0 [active] => 1 [available_for_order] => 1 [condition] => new [show_price] => 1 [indexed] => 1 [cache_is_pack] => 0 [cache_has_attachments] => 0 [cache_default_attribute] => 72774 [date_add] => 0000-00-00 00:00:00 [date_upd] => 2012-08-18 13:57:42 [id_lang] => 5 [description] => Apri il tuo armadio e ti sembra di non avere mai il capo giusto? Con questa maglia non avrai più problemi, glamour con un tocco di vivacità, un capo unico, proprio come te. [description_short] => Un tocco di romanticismo glam per la tua estate 2012 [link_rewrite] => your-t-shirt [meta_description] => t-shirt Sweet ribbon [meta_keywords] => t-shirt,tshirt,sweet ribbon,romanticismo,romatica,cinta,estate [meta_title] => t-shirt Sweet ribbon [name] => Sweet ribbon [available_now] => [available_later] => [tax_rate] => [manufacturer_name] => [supplier_name] => ) [1] => Array ( [id_product] => 820 [id_supplier] => 0 [id_manufacturer] => 0 [id_tax_rules_group] => 0 [id_category_default] => 60 [id_color_default] => 0 [on_sale] => 0 [online_only] => 0 [ean13] => [upc] => [ecotax] => 0.000000 [quantity] => 3520 [minimal_quantity] => 1 [price] => 9.590000 [wholesale_price] => 0.000000 [unity] => [unit_price_ratio] => 0.000000 [additional_shipping_cost] => 0.00 [reference] => reference [supplier_reference] => 82 [location] => [width] => 0 [height] => 0 [depth] => 0 [weight] => 0 [out_of_stock] => 2 [quantity_discount] => 0 [customizable] => 0 [uploadable_files] => 0 [text_fields] => 0 [active] => 1 [available_for_order] => 1 [condition] => new [show_price] => 1 [indexed] => 1 [cache_is_pack] => 0 [cache_has_attachments] => 0 [cache_default_attribute] => 68550 [date_add] => 0000-00-00 00:00:00 [date_upd] => 2012-08-18 13:59:45 [id_lang] => 5 [description] => [description_short] => "Mani che sfiorano il suono della vita." Ignazio Gagliano [link_rewrite] => your-t-shirt [meta_description] => t-shirt mani che sfiorano il suono della vita [meta_keywords] => t-shirt,tshirt,mani,chitarra,suono,musica,vita [meta_title] => t-shirt mani chitarra [name] => Mani e Chitarra [available_now] => [available_later] => [tax_rate] => [manufacturer_name] => [supplier_name] => ) ) [supplier_reference] is on the field that identifies the user who created the product
  13. list of products

    I'm already writing a module. The products "user-created" have a specific range (supplier_reference) that contains the id of the user who created the product. I wish that when you click on the avatar of the user (http://www.mytshirt.name/mytshirt/wizardshirt/community.php) this face to see the list of products created using that particular field. The output will be identical to that of a category. The category contains products created by users is always the same, with id 60. Do you understand?
  14. list of products

    Hello, I say alone. $ product_list = Product :: getProducts ($ cookie-> id_lang, 0,0, 'id_product', 'ASC', 60, true); print_r ($ product_list); So actually I see the products, but I have to tie them to category.tpl, like you said you now try to understand.
  15. list of products

    hello, thanks for the reply. Do you have a document that explains how to use GetProdutcs? I'm having some difficulty understanding how to use it
×