Fabrizio Cocchi: differenze tra le versioni

Da Webmobili Wiki.
Riga 69: Riga 69:




public static function vai_al_carrello ($wishlist){
public static function vai_al_carrello ($wishlist){
$items_count = WC()->cart->get_cart_contents_count();
?>
?>
<div class="wm-carrello">
<div class="wm-carrello">
<a href="<?php echo wc_get_cart_url(); ?>">Vai al carrello</a>
<a href="<?php echo wc_get_cart_url(); ?>">
<svg fill="#000" class="nmgr-icon align-with-text" xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path d="M24 3l-.743 2h-1.929l-3.474 12h-13.239l-4.615-11h16.812l-.564 2h-13.24l2.937 7h10.428l3.432-12h4.195zm-15.5 15c-.828 0-1.5.672-1.5 1.5 0 .829.672 1.5 1.5 1.5s1.5-.671 1.5-1.5c0-.828-.672-1.5-1.5-1.5zm6.9-7-1.9 7c-.828 0-1.5.671-1.5 1.5s.672 1.5 1.5 1.5 1.5-.671 1.5-1.5c0-.828-.672-1.5-1.5-1.5z"></path></svg>
Vai al carrello <?php echo $items_count > 0 ? "(".$items_count.")" : "";?>
</a>
</div>
</div>
<?php
<?php

Versione delle 14:22, 7 mag 2025

Info

Account su Register. Abbiamo creato un sottodominio listanozze e puntato al nostro Apache su AWS.

Register

AFC288-EURO
Fabrizio2020!

Personalizzazioni plugin lista notte

Plugin -> nm-gift-registry

griglia default -> Includes/lib/Setup + css personalizzato -> .nmgr-display-modes {display: none;}

non cliccabile il prodotto -> Includes/Table/iItemsTable.php riga 224

Traduzioni

Inserire i file delle traduzioni creati con PoEdit a mano qui: listanozze.fabriziococchi.com/wp-content/languages/plugins

I file sono nm-gift-registry-it_IT.po e nm-gift-registry-it_IT.mo

Aggiunta Cadauno al prezzo

Modificato file originale del plugin nm-gift-registry\includes\Tables\ItemsTable.php

public function get_item_cost() {
		ob_start();
		$item = $this->get_row_object();

		$cost_per_item_text = nmgr()->is_pro ?
			__( 'Cost per item', 'nm-gift-registry' ) :
			__( 'Cost per item', 'nm-gift-registry-lite' );
		?>
		
		<div class="nmgr-tip" title="<?php echo esc_attr( $cost_per_item_text ); ?>">
			<?php echo wp_kses_post( $item->get_cost( true )." (cad.)" ); ?>
		</div>
		<?php
		return ob_get_clean();
	}

Modificato file del plugin nm-gift-registry\includes\Lib\Single.php

Al fondo aggiunta la funzione e aggiunto link Vai al Carrello e all'inizio del file:

<?php
	public static function run() {
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_images' ), 10 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_title' ), 20 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_display_name' ), 30 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_event_date' ), 40 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_description' ), 50 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'vai_al_carrello' ), 51 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_notices' ), 60 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_items' ), 70 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'show_share_links' ), 80 );
		//add_action( 'nmgr_wishlist', array( __CLASS__, 'show_copy_link' ), 90 );
		add_action( 'nmgr_wishlist', array( __CLASS__, 'vai_al_carrello' ), 91 );
	}


	public static function vai_al_carrello ($wishlist){
		$items_count = WC()->cart->get_cart_contents_count();
		?>
		<div class="wm-carrello">
			<a href="<?php echo wc_get_cart_url(); ?>">		
								<svg fill="#000" class="nmgr-icon align-with-text" xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path d="M24 3l-.743 2h-1.929l-3.474 12h-13.239l-4.615-11h16.812l-.564 2h-13.24l2.937 7h10.428l3.432-12h4.195zm-15.5 15c-.828 0-1.5.672-1.5 1.5 0 .829.672 1.5 1.5 1.5s1.5-.671 1.5-1.5c0-.828-.672-1.5-1.5-1.5zm6.9-7-1.9 7c-.828 0-1.5.671-1.5 1.5s.672 1.5 1.5 1.5 1.5-.671 1.5-1.5c0-.828-.672-1.5-1.5-1.5z"></path></svg>
				Vai al carrello <?php echo $items_count > 0 ? "(".$items_count.")" : "";?>
			</a>
		</div>	
		<?php
	}

Tema figlio

Functions.php

Css personalizzato

/*Opzioni visualizzazione lista/griglia articoli*/
.nmgr-display-modes {display: none;}

/*Bottone Aggiungi al carrello*/
.nmgr_add_to_cart_button.button {
  display: inline-block;
  font-weight: 400;
  color: #fff;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  background-color: #000;
  border: 1px solid #000;
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 0.375rem;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
  text-decoration: none;
}

.nmgr_add_to_cart_button.button:hover {
  background-color: #9e9e9e;
  border-color: #9e9e9e;
}

.nmgr_add_to_cart_button.button:active {
  background-color: #000;
  border-color: #000;
}
/*nascondere Footer Colibri*/
#copyright{
	display:none;
}