Opencart: agregue "Agregar a la lista de deseos" a las páginas de categoría
Frecuentes
Visto 2,409 veces
0
Intentando agregar "agregar a la lista de deseos" a la codificación para que se muestre en las páginas de Categoría. Por lo tanto, cada producto que se muestra en el campo de categoría tendrá su propio botón "AÑADIR A LA LISTA DE DESEOS" por separado. También replicaré esto en el método de búsqueda, ya que muchas de mis categorías son en realidad búsquedas. El sitio en el que estoy trabajando tiene muchos productos similares y son principalmente visuales, por lo que sería muy útil.
El código actual que tengo para AGREGAR A LA LISTA DE DESEOS es (omití el CSS, ¡no hay necesidad de aburrir a nadie!):
<a class="wish_add" href="<?php echo $add_to_wishlist[$j]['add']; ?>" title="<?php echo $button_to_wishlist; ?>" rel="nofollow"><span><?php echo $button_to_wishlist; ?>+ Favorites</span></a>
El Código de toda la página es (CATEGORY.TPL):
<div class="clear"> </div><!--[if lt IE 7]><br /><![endif]-->
<?php if (!$categories && !$products) { ?>
<div class="content"><?php echo $text_error; ?></div>
<?php } ?>
<?php
if($_SERVER['QUERY_STRING']!='_route_=ketubahs'){
?>
<!--<?php /* if ($categories) { */ ?> -->
<?php if ($categories && $heading_title!="Scroll Down to View All Our Ketubahs on One Page") { ?>
<table class="listC" cellspacing="7">
<?php for ($i = 0; $i < sizeof($categories); $i = $i + 4) {
$numpages=sizeof($products);
?>
<tr>
<?php for ($j = $i; $j < ($i + 4); $j++) { ?>
<td width="25%"><?php if (isset($categories[$j])) { ?>
<a href="<?php echo $categories[$j]['href']; ?>"><img src="<?php echo $categories[$j]['thumb']; ?>" title="<?php echo $categories[$j]['name']; ?>" alt="<?php echo $categories[$j]['name']; ?>" style="margin-bottom: 3px;" /></a><br />
<a href="<?php echo $categories[$j]['href']; ?>"><?php echo $categories[$j]['name']; ?></a>
<?php } ?></td>
<?php } ?>
</tr>
<?php } ?>
</table>
<?php }
}
?>
<?php if ($products) { ?>
<!-- <div class="sort"> -->
<div class="sort" <?php if ($heading_title=="Scroll Down to View All Our Ketubahs on One Page") { echo "style='margin-top:-40px;'"; } ?> >
<div class="div1">
<select name="sort" onchange="location = this.value">
<?php foreach ($sorts as $sorts) { ?>
<?php if (($sort . '-' . $order) == $sorts['value']) { ?>
<option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
<?php } else { ?>
<option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
<div class="div2"><?php echo $text_sort; ?></div>
</div>
<table class="listC" cellspacing="7">
<?php for ($i = 0; $i < sizeof($products); $i = $i + 4) {
$numpages=sizeof($products);
?>
<tr>
<?php for ($j = $i; $j < ($i + 4); $j++) { ?>
<td width="25%">
<?php if (isset($products[$j])) { ?>
<a href="<?php echo $products[$j]['href']; ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" width="210px" height="210px" /></a><br /><Br />
<div style="margin-top:-15px;"><a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
<?php if($products[$j]['artist'] != 'Rosenthal, Gary' and $products[$j]['artist'] != 'Jessy Judaica' and !empty($products[$j]['artist'])){
$artist_fname=substr($products[$j]['artist'],strpos($products[$j]['artist'],",")+1);
$artist_lname=substr($products[$j]['artist'],0,strpos($products[$j]['artist'],","));
$artist_fullname=trim($artist_fname)." ".trim($artist_lname);
if (trim($products[$j]['artist'])=="Zeev") {
$artist_fullname="Ze'ev"; }
if (trim($products[$j]['artist'])=="This is not a Ketubah") {
$artist_fullname="This is not a Ketubah"; }
$artistname=str_replace(' ','-',$artist_fullname);
if (trim($artistname)=="Ze'ev") {
$artistname="Ze-ev"; }
if (trim($artistname)=="This is not a Ketubah") {
$artistname="This is not a Ketubah"; }
$artist_path='meet-our-artists/'.strtolower($artistname);
?>
<a href="<?php echo $artist_path; ?>"><span style="color:#FFF;font-weight:200;"><?php echo $artist_fullname; ?></span></a><br />
<?php } else { ?>
<span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
<?php } ?>
<?php if ($display_price) { ?>
<?php if (!$products[$j]['special']) { ?>
<span style="color: #00d8ff; font-weight: bold;cursor:default;"><?php echo $products[$j]['price']; ?></span>
<?php } else { ?>
<span style="color: #00d8ff; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #FAA; font-weight: bold;"><?php echo $products[$j]['special']; ?></span>
<?php } ?>
</div>
<?php } ?>
<br />
<?php if ($products[$j]['rating']) { ?>
<img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
<?php } ?>
<?php } ?>
<a class="wish_add" href="<?php echo $add_to_wishlist[$j]['add']; ?>" title="<?php echo $button_to_wishlist; ?>" rel="nofollow"><span><?php echo $button_to_wishlist; ?>+ Favorites</span></a>
<a class="cart_add" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" ><span><?php echo $button_add_to_cart; ?></span></a>
</td>
<?php } ?>
</tr>
<?php } ?>
</table>
<div class="pagination" style="width:950px;text-align:right"><?php
if (($numpages-$ii)>1) {
echo "Displaying all ".($numpages-$ii)." items in this category.";
} else {
echo "Displaying 1 item in this category.";
} ?></div>
<?php } ?>
</div>
<div class="bottom">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>
</div>
<?php echo $footer; ?>
¡Cualquier ayuda sería increíble!
¡Salud
AG
1 Respuestas
0
Descubrí esto. Hay una función deshabilitada en el controlador que impedía que el botón entrara en producción:
Ubicado en Controlador/categoría/categoría.php
$this->data['add_to_wishlist'] = HTTPS_SERVER . 'index.php?route=product/wishlist&p=' . $result['product_id'];
una vez habilitado, alimenta el resto del código de la lista de deseos para Opencart, lo que me permite colocar la Lista de deseos y agregar al carrito en cada producto dentro de la página de categoría:
ubicado en vista/categoría/categoría.php
<a href="<?php echo $add_to_wishlist; ?>" class="wish_add" rel="nofollow"><span><?php echo $button_to_wishlist; ?>+ Favorites</span></a>
Respondido el 28 de junio de 12 a las 17:06
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php button e-commerce opencart or haz tu propia pregunta.