


How to call the shopping cart order quantity on the entire site of Dedecms5.7
How to call the shopping cart order quantity on the entire site of Dedecms5.7?
When I was selling the Dedecms5.7 GBK/UTF-8 Tenpay interface plug-in module, a netizen asked me about the number of orders in the shopping cart called by the Dedecms5.7 website. I checked the manual and couldn't find any relevant knowledge
Recommended study:梦Weavercms
After thinking about it, it's actually quite simple, just call the cookie data. Later I took a look at the Dedecms shopping cart class shopcar.class.php and found that there is a ready-made function cartCount available. In order not to affect the template call, I wrote a simple file myself and called it with javascript.
The method is implemented as follows:
1. Create a my_car_count.php file and place it under the /plus/ directory;
2. Write the following code:
The code is as follows:
<?php /** * my_car_count.php * /plus * 显示购物车的商品数量 * https://www.jb51.net/cms * QQ: 834114969 */ require_once (dirname(__FILE__) . "/../include/common.inc.php"); define('_PLUS_TPL_', DEDEROOT.'/templets/plus'); require_once(DEDEINC.'/dedetemplate.class.php'); require_once DEDEINC.'/shopcar.class.php'; $cart = new MemberShops();</p> <p>$car_count = 0;</p> <p>if($cart->cartCount() >= 1) { $car_count = $cart->cartCount(); } echo ('document.write("' . $car_count . '"); '); exit; ?>
3. Write the calling code where you need to call it, for example: the number of items in the shopping cart
Finally, it’s very simple, isn’t it!
The above is the detailed content of How to call the shopping cart order quantity on the entire site of Dedecms5.7. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!