Jump to content

madmega

Members
  • Posts

    33
  • Joined

  • Last visited

Profile Information

  • Location
    Netherlands
  • Activity
    Developer

madmega's Achievements

Newbie

Newbie (1/14)

0

Reputation

1

Community Answers

  1. Hi, thank you for your answer, i've tried that but unfortunately, still no difference, i will post, the piece of code from the php file that loads the ajax.php </div> <div class="clear"> </div> <script type="text/javascript"> var formProduct; var accessories = new Array(); function showReducOptions(e) { if($(e).val() && $(e).val()!=3) { $(".toReduc").slideDown("fast"); }else { $(".toReduc").slideUp("fast"); } } var filled = false; function fillAccessories() { if(filled) return; $.getJSON("'.__PS_BASE_URI__.'modules/pm_advancedpack/ajax.php",{ajaxProduct:1,id_lang:'.intval($cookie->id_lang).'}, function(j) { filled = true; for (var i = 0; i < j.length; i++) accessories[i] = new Array(j[i].value, j[i].text); formProductSelection = document.layers ? document.forms.discount : document.discount; formProductSelection.selectProductSelection.length = accessories.length + 1; for (i = 0, j = 0; i < accessories.length; i++) { if (formProductSelection.filter.value) if (accessories[i][1].toLowerCase().indexOf(formProductSelection.filter.value.toLowerCase()) == -1) continue; formProductSelection.selectProductSelection.options[j].value = accessories[i][0]; formProductSelection.selectProductSelection.options[j].text = accessories[i][1]; j++; } if (j == 0) { formProductSelection.selectProductSelection.length = 2; formProductSelection.selectProductSelection.options[1].value = -1; formProductSelection.selectProductSelection.options[1].text = \''.$this->l('No match found').'\'; formProductSelection.selectProductSelection.options.selectedIndex = 1; } else { formProductSelection.selectProductSelection.length = j; formProductSelection.selectProductSelection.options.selectedIndex = (formProductSelection.filter.value == \'\' ? 0 : 0); } } ); } </script> <select id="selectProductSelection" name="selectProductSelection" style="width: 380px;" onfocus="fillAccessories();"> <option value="0" selected="selected">-- '.$this->l('Choose').' --</option> </select> <span onclick="addProductToSelection('.($obj->id ? $obj->id : 0).');" style="cursor: pointer;"><img src="../img/admin/add.gif" alt="'.$this->l('Add an accessory').'" title="'.$this->l('Add an accessory').'" /></span> <br />'.$this->l('Filter:').' <input type="text" size="25" name="filter" onkeyup="filled = false;fillAccessories();" class="space" /> <input type="hidden" value="" name="inputProductsSelection" id="inputProductsSelection" /> </td> </tr></table>
  2. Hi, i have a problem concerning a module called PM_advancedpack, we've contacted the creator but they do not give support for older prestashop versions. The problem we have with the module is as follows, when creating a new productpack, you have to choose what products you want into the pack, and there is where it goes wrong. We cannot choose the products, when i click on CHOOSE button, nothing happens. There is file called ajax.php that should be getting the products from the database. And there is a file AdminAdvancedPack.php that is getting the results from ajax.php and should be displaying them (no, no TPL involved). But all we are getting is a empty product list, were should i start looking ? This is the ajax.php file <?php include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); include_once(dirname(__FILE__).'/AdvancedPackClass.php'); if (isset($_GET['ajaxProduct'])) { $currentIndex = 'index.php?tab=AdminCatalog'; $jsonArray = array(); $products = Db::getInstance()->ExecuteS(' SELECT p.`id_product`, pl.`name`, pl.`link_rewrite`, p.`reference`, i.`id_image` FROM `'._DB_PREFIX_.'product` p NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) WHERE pl.`id_lang` = '.intval(Tools::getValue('id_lang')).''); foreach ($products AS $accessory) { $curQty = Product::getQuantity($accessory['id_product']); if(_PS_VERSION_ < '1.4.3') $jsonArray[] = array("value"=>intval($accessory['id_product']).'-'.$accessory['name'].'-'.$accessory['reference'].' (stock : '.$curQty.')|'.$accessory['id_image'].'¤'.AdvancedPackClass::isProductPackPage($accessory['id_product']),"text"=>intval($accessory['id_product']).' - '.$accessory['name'].' - '.$accessory['reference'].' (stock : '.$curQty.')'); else $jsonArray[] = array("value"=>intval($accessory['id_product']).'-'.$accessory['name'].'-'.$accessory['reference'].' (stock : '.$curQty.')|'.$link->getImageLink($accessory['link_rewrite'], Product::defineProductImage($accessory, Tools::getValue('id_lang')),'small').'¤'.AdvancedPackClass::isProductPackPage($accessory['id_product']),"text"=>intval($accessory['id_product']).' - '.$accessory['name'].' - '.$accessory['reference'].' (stock : '.$curQty.')'); } echo json_encode($jsonArray); die(); } if (isset($_GET['ajaxImage'],$_GET['id_product'])) { $id_product = intval($_GET['id_product']); $id_image = intval($_GET['id_image']); $images = Image::getImages(intval($cookie->id_lang), $id_product); $imagesTotal = Image::getImagesTotal($id_product); if (sizeof($images)) { echo '<select name="imgs_product[]" onchange="changeProductImg(this);">'; foreach ($images AS $k => $image) { echo'<option value="'.intval($image['id_image']).'" '.($id_image == $image['id_image']?'selected=selected':'').'>'.$image['legend'].'</option>'; } echo '</select>'; } } ?>
  3. What i want to do is to have a specific category in a specific cms page. I can include the product-list.tpl in a cms.tpl page I have a problem with showing a product-list inside my cms.tpl page. I have included the file product-list.tpl and it is showing all my products, but there is no name/title for the products. I have Prestashop 1.4.8.2 There must be a simpeler way to get product list showing in a cms page from a certain category.
  4. Hi, we've installed this module, giftonshop, and it works great. But now we want something different done to it. This module shows group of gifts with a product, as a extra, with each brand, you can choose from 4 gifts. But it is also possible to have another group of gifts, which shows up as another div block where you can choose 4 gifts. Those gifts are other products... What we want is to have 1 block, showing all 8 gifts. The problem is, that the block extra_right.tpl is called with every group of gifts. So all the arrays in that block are concentrated one ID in the database, say for instance that group1, that has 4 gifts, has a ID of 21. Group 2 has 4 gifts and has a ID of 22. So when extra_right.tpl is called from ID 21, i cannot get products from ID 22. And i do not know how to call them, i can make if statements and foreach loops, but they all contain the products from ID 21. Here is the code: {if isset($giftonorder_gifts_of_product) AND count($giftonorder_gifts_of_product)} {foreach from=$giftonorder_gifts_of_product item=gift} {if sizeof($gift.gift_products_list) > 0} <div class="giftonorder_productgifts"> {if $gift.id_giftonorder == 21} <h2>Amplug & Amphones</h2> {else} <h2>{$gift.name}</h2> {/if} <div style="padding: 10px"> <p><span class="choose_gift">{l s='Choose your gift:' mod='giftonordermodule'}</span> <select name="noname" class="giftonorder_preselector" > {foreach from=$gift.gift_products_list key=key_gift_prod item=gift_prod name=counter} <option {if $key_gift_prod==$gift.index_selected_gift}selected="SELECTED"{/if} value="{$gift.id_giftonorder}_{$gift_prod->id}" >{$gift_prod->legend|truncate:2000:'...'|escape:htmlall:'UTF-8'} </option> {/foreach} {if $gift.id_giftonorder == 21} {foreach from=$gift.gift_products_list item=gift_prod name=counter} <option {if $key_gift_prod==$gift.index_selected_gift}selected="SELECTED"{/if} value="{$gift.id_giftonorder}_{$gift_prod->id}" >{$gift_prod->legend|truncate:2000:'...'|escape:htmlall:'UTF-8'} </option> <option {if $key_gift_prod==$gift.index_selected_gift}selected="SELECTED"{/if} value="{22}_{39492}" >MARK </option> {/foreach} {/if} </select> </p> {foreach from=$gift.gift_products_list key=key_gift_prod item=gift_prod name=counter} <p style="text-align: center"> <img class="goo_preselectinfo goo_preselectinfo_{$gift.id_giftonorder}_{$gift_prod->id} {if $key_gift_prod<>$gift.index_selected_gift}hidden{/if}" src="{$link->getImageLink($gift_prod->link_rewrite, $gift_prod->id_image, 'large')}" alt="{$gift_prod->legend}" height="{$largeSize.height}" width="{$largeSize.width}" /> </p> <p style="text-align: center" class="goo_preselectinfo goo_preselectinfo_{$gift.id_giftonorder}_{$gift_prod->id} {if $key_gift_prod<>$gift.index_selected_gift}hidden{/if}" >{$gift_prod->legend} {if $gift_prod->price_without_reduction_wtx <> 0} <span class="price strike"> {if !$priceDisplay || $priceDisplay == 2} <span >{convertPrice price=$gift_prod->price_without_reduction_wtx}</span> {/if} {if $priceDisplay == 1} <span >{convertPrice price=$gift_prod->price_without_reduction_wotx}</span> {/if} </span> {/if} </p> <p style="text-align: center" class="goo_preselectinfo goo_preselectinfo_{$gift.id_giftonorder}_{$gift_prod->id} {if $key_gift_prod<>$gift.index_selected_gift}hidden{/if}" > {$gift_prod->description_short|strip_tags|truncate:170:'...'} </p> {/foreach} <p class='align_center'><a class="button" href="{$modules_dir}giftonordermodule/all_giftonorder.php">{l s='See Conditions' mod='giftonordermodule'}</a></p> </div> </div> {/if} {/foreach} {/if} The piece of code: {if $gift.id_giftonorder == 21} {foreach from=$gift.gift_products_list item=gift_prod name=counter} <option {if $key_gift_prod==$gift.index_selected_gift}selected="SELECTED"{/if} value="{$gift.id_giftonorder}_{$gift_prod->id}" >{$gift_prod->legend|truncate:2000:'...'|escape:htmlall:'UTF-8'} </option> <option {if $key_gift_prod==$gift.index_selected_gift}selected="SELECTED"{/if} value="{22}_{39492}" >MARK </option> {/foreach} {/if} Is the place where it should get all the entries from ID 22, but how do i do it ?
  5. Hi, i've searched for this for a long time, and i do not exactly understand how to do it. I have the file products.tpl In there i want to add the following line {$category_product->id_product|@debug_print_var} But it results in NULL I call it a table, but maybe i have the wrong name for it. I cannot call to the table ps_category_product and row id_product, inside product.tpl, i do not understand why, can somebody assist me ?
  6. Hoi, misschien heb ik het onderwerp niet goed omschreven maar... ik probeer al een tijdje te begrijpen hoe ik andere tables in bijvoorbeeld de product.tpl kan krijgen. Ik wil bijvoorbeeld vanuit ps_category_product, de rij id_category, weergeven bij een product. Dus simpelweg een print {$category_product->id_product|@debug_print_var} maar ik krijg een NULL, en het lijkt erop dat alleen rijen uit de ps_product table zichtbaar zijn in de product.tpl maar hoe krijg ik andere tables en rijen hier in ?
  7. I have this entry in product-list.tpl {if $product.media}<span class="media icon_{$product.media}">{l s='Media'}</span>{/if} It checks wether a product has a media entry in the database. I checked classes/category.php and found this: SELECT p.*, md.`type` AS media, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new, (p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice FROM `'._DB_PREFIX_.'category_product` cp LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1) LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)Country::getDefaultCountryId().' AND tr.`id_state` = 0) LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)($id_lang).') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` LEFT JOIN `'._DB_PREFIX_.'vms_media` md ON md.`vms_guid` = p.`vms_guid` I tried to add vs.`id_store` AS store, vs2.`quantity` AS quantity2, and added LEFT JOIN `'._DB_PREFIX_.'vms_stock` vs ON vs.`id_product` = p.`id_product` LEFT JOIN `'._DB_PREFIX_.'vms_stock` vs2 ON vs2.`quantity` = p.`quantity` than call this from product-list.tpl {if $product.store == 6 && $product.quantity2 > 0} but it doesn't seem to work...am i missing something, because i tried to look inside the categorycontroller but i do not understand how to get this working. in the database PS_VMS_MEDIA,
  8. How are the classes being used, what is the class file that goes with the product_List.tpl file ?
  9. I am sorry, i am trying to understand how to program it
  10. But the entries i want are from another table, i think in the categorycontroller.php it only fetches data from the PS_category in the databse
×
×
  • Create New...