Design Meets Code

Design Meets Code

WordPress · PrestaShop

  • Startseite
  • WordPress
  • PHP / Datenbanken
  • Ubuntu
  • Prestashop
  • Grafik
  • Glossar

Prestashop: Mass-edit Products / Mehrere Produkte auf einmal bearbeiten

14. November 2014 Leave a Comment

Um bequem mehrere Produkte auf einmal zu bearbeiten, bietet Prestashop bisher keine Standardfunktionen. Es gibt jedoch ein von der Community entwickeltes Modul, das diese Lücke füllt.
Product mass-edit, Categories mass-edit, Order mass-edit.

Die Installation ist relativ einfach. Das Modul wird nicht wie normale Module installiert. Die Zip-Datei muss entpackt werden und der entpackte Ordner per ftp in den admin Ordner geladen werden. Die Bearbeitung der Produkte erfolgt dann über einen Link: www.myshop.com/myadmin/order_edit.php

Diese Datei ist passwortgeschützt. Es ist ein Standardpasswort „opensecret“ vorgegeben. Nutzername und Passwort sollten vor dem Upload in der Datei settings1.php geändert werden.

Ein sehr nützliches Plugin, das in der neuesten Version auch von Prestashop 1.6.X unterstützt wird.

triple_edit-1.07a

Filed Under: Prestashop

Prestashop: Zufällige Anordnung von Produkten im Featured Products Module

2. Februar 2014 Leave a Comment

Um eine zufällige Anordnung von Produkten im Featured Module zu erreichen, kann man die shuffle() Funktion wie folgt in homefeatured.tpl vor den for each-Loop einbauen

Ursprünglicher Code

	<ul style="height:{$ulHeight}px;">
			{foreach from=$products item=product name=homeFeaturedProducts}

Mit Shuffle Funktion

	<ul style="height:{$ulHeight}px;">
			{capture}{$products|@shuffle}{/capture}
			{foreach from=$products item=product name=homeFeaturedProducts}

Es wird also die Zeile {capture}{$products|@shuffle}{/capture} eingefügt.

Nun muss noch die Cache Funktion ausgeschaltet werden, damit nicht der Cache, sondern die zufällige Produktanordnung gezeigt wird. Dies geschieht in der Datei homefeatured.php

Hier die folgende Funktion suchen

	public function hookDisplayHome($params)
	{
		if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
		{
			$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
			$nb = (int)Configuration::get('HOME_FEATURED_NBR');
			$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), "position");
			shuffle($products);
			$this->smarty->assign(array(
				'products' => $products,
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			));
		}
		return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId());

Hier wird nun die Zeile if (!$this->isCached(‚homefeatured.tpl‘, $this->getCacheId())) mit zwei vorangestellten // auskommentiert. Ebenso die nachfolgende öffnende und schließende geschweifte Klammer. In der letzten Zeile wird das letzte Komma und der nachfolgende Parameter mit dem Cachehinweis entfernt , $this->getCacheId() so dass die Funktion dann wie folgt aussieht:

	public function hookDisplayHome($params)
	{
	//	if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
	//	{
			$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
			$nb = (int)Configuration::get('HOME_FEATURED_NBR');
			$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), "position");
			shuffle($products);
			$this->smarty->assign(array(
				'products' => $products,
				'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
				'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			));
	//	}
		return $this->display(__FILE__, 'homefeatured.tpl');

Die Shuffle Funktion kann auch in die Funktion displayHome eingebaut werden und muss dann nicht in die homefeatured.tpl eingefügt werden:

public function hookDisplayHome($params){
$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
$nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
/*$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10));*/
$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10), 'date_add', 'DESC', false, true, true, $nb);

shuffle($products);
$this->smarty->assign(array(
'products' => $products,
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'homeSize' => Image::getSize('home_default'),
));
return $this->display(__FILE__, 'homefeatured.tpl');
}

Filed Under: Prestashop Tagged With: Prestashop 1.6, Zufällige Anordnung von Produkten

Prestashop: Produkt-Tags in der Produktbeschreibung anzeigen

29. Januar 2014 Leave a Comment

Um Tags auf der Produkteinzelansicht zu zeigen, öffne die Datei product.tpl und suche die Zeile

<div id="primary_block" class="clearfix">

Direkt dahinter füge dann folgenden Code ein

<ul class="producttags">
    {foreach from=Tag::getProductTags(Tools::getValue('id_product')) key=k item=v}
        {foreach from=$v item=value}
            <li><a href="{$link->getPageLink('search', true, NULL, "tag={$value|urlencode}")}">{$value|escape:html:'UTF-8'}</a></li>
        {/foreach}
    {/foreach}
</ul>

Um die Tags zu stylen, füge folgende CSS Deklarationen in die global.css ein

.producttags {
    list-style:none;
    position:relative;
    clear:both;
    display:block;
    padding-bottom:20px;
    margin-bottom:20px;
}
 
.producttags li, .producttags a{
    float:left;
    height:24px;
    line-height:24px;
    position:relative;
    font-size:11px;
    }
 
.producttags a{
    margin-left:20px;
    padding:0 10px 0 12px;
    background:#0089e0;
    color:#fff;
    text-decoration:none;
    -moz-border-radius-bottomright:4px;
    -webkit-border-bottom-right-radius:4px;
    border-bottom-right-radius:4px;
    -moz-border-radius-topright:4px;
    -webkit-border-top-right-radius:4px;   
    border-top-right-radius:4px;   
}
.producttags a:visited{
    color:#fff;
}
 
.producttags a:before{
    content:"";
    float:left;
    position:absolute;
    top:0;
    left:-12px;
    width:0;
    height:0;
    border-color:transparent #0089e0 transparent transparent;
    border-style:solid;
    border-width:12px 12px 12px 0;     
}
 
.producttags a:after{
    content:"";
    position:absolute;
    top:10px;
    left:0;
    float:left;
    width:4px;
    height:4px;
    -moz-border-radius:2px;
    -webkit-border-radius:2px;
    border-radius:2px;
    background:#fff;
    -moz-box-shadow:-1px -1px 2px #004977;
    -webkit-box-shadow:-1px -1px 2px #004977;
    box-shadow:-1px -1px 2px #004977;
}
 
.producttags a:hover{background:#555; text-decoration:none;}   
 
.producttags a:hover:before{border-color:transparent #555 transparent transparent;}

Nun erscheinen die Produkt-Tags gleich oberhalb der Produktbeschreibung. Sie können natürlich auch an einer anderen Stelle eingefügt werden.

tags

Quelle: mypresta.eu

Ist der Shop mehrsprachig angelegt, so filtert der folgende Code die Tags nach Sprache:

{if isset($product->tags) && $product->tags}
<ul class="producttags">

{assign var='id_lang' value=Language::getIdByIso($lang_iso)}
{assign var='productTags' value=$product->tags}
{foreach from=$productTags[$id_lang] item=productTag name=productTags}
<li>  <a href="{$base_dir}index.php?controller=search&tag={$productTag|escape:'url'}"><strong>{$productTag}</strong></a></li>{if !$smarty.foreach.productTags.last}, {/if}
{/foreach}
</ul>
{/if}

Quelle: prestashop.com

Filed Under: Prestashop Tagged With: Prestashop 1.5, Produkt-Tags

  • « Previous Page
  • 1
  • …
  • 4
  • 5
  • 6
  • 7
  • Next Page »
Anzeige

Themen

Apache BuddyPress Code Snippets Datenbank Email Enfold genesis Grid View htaccess imscp Indesign Katalogpreisregel Layout Builder LibreOffice Lieferschein List View Logout Mitgliederbereich MySQL PHP PHP Anfänger PHP Variablen Plugins Prestashop Prestashop 1.5 Prestashop 1.6 Prestashop 1.7 Prestashop 8 Prestashop Module Registrierung RSS Feed s2member Screencast Server Sicherheit ssl Startseite Strings Tipps Windows Windows 10 Windows 11 WooCommerce WooCommerce Sortierung WordPress
Anzeige

Letzte Kommentare

  • Martin bei CSS: Automatische Silbentrennung in einzelnen Wörtern verhindern
  • Martin bei CSS: Automatische Silbentrennung in einzelnen Wörtern verhindern
  • Klaus bei Woocommerce: Shop Seiten neu generieren
  • Thomas bei WordPress: Einzelne Kategorien aus dem RSS Feed ausschließen
  • Bernhard bei CSS: Automatische Silbentrennung in einzelnen Wörtern verhindern

Informationen

  • Kontakt
  • Datenschutzerklärung
  • Impressum
  • Cookie-Richtlinie (EU)
  • Kontakt
  • Datenschutzerklärung
  • Impressum
  • Cookie-Richtlinie (EU)
Anzeige