Display product with price down in custom module - prestashop-1.6

I would like to find out what I'm doing wrong. I created a module and in the getContent () function I wanted to display products that have a discount, I used that
$products = Product::getPricesDrop((int)$this->context->language->id, 0, 10);
The problem is that it gets Notice in line 2376 in C: \ wamp64 \ www \ xxxxx \ classes \ Product.php [8] Trying to get property of non-object
I do it in the module.php file

Related

Eventarc triggers for crossproject

I have created a cloud run service. My event arc is not triggering the cross project to read the data. How to give the event filter for resource name in event arc with insert job/Job completed to trigger to BQ table.
gcloud eventarc triggers create ${SERVICE}-test1\
--location=${REGION} --service-account ${SVC_ACCOUNT} \
--destination-run-service ${SERVICE} \
--destination-run-region=${REGION} \
--event-filters type=google.cloud.audit.log.v1.written \
--event-filters methodName=google.cloud.bigquery.v2.JobService.InsertJob \
--event-filters serviceName=bigquery.googleapis.com \
--event-filters-path-pattern resourceName="/projects/destinationproject/locations/us-central1/jobs/*"
I have tried multiple options giving the resource name like:
"projects/projectname/datasets/outputdataset/tables/outputtable"

How to use a custom dataset for T5X?

I've created a custom seqio task and added it to the TaskRegistry following the instruction per the documentation. When I set the gin parameters, accounting for the new task I've created, I receive an error that says my task does not exist.
No Task or Mixture found with name [my task name]. Available:
Am I using the correct Mixture/Task module that needs to be imported? If not, what is the correct statement that would allow me to use my custom task?
--gin.MIXTURE_OR_TASK_MODULE=\"t5.data.tasks\"
Here is the full eval script I am using.
python3 t5x/eval.py \
--gin_file=t5x/examples/t5/t5_1_0/11B.gin \
--gin_file=t5x/configs/runs/eval.gin \
--gin.MIXTURE_OR_TASK_NAME=\"task_name\" \
--gin.MIXTURE_OR_TASK_MODULE=\"t5.data.tasks\" \
--gin.partitioning.PjitPartitioner.num_partitions=8 \
--gin.utils.DatasetConfig.split=\"test\" \
--gin.DROPOUT_RATE=0.0 \
--gin.CHECKPOINT_PATH=\"${CHECKPOINT_PATH}\" \
--gin.EVAL_OUTPUT_DIR=\"${EVAL_OUTPUT_DIR}\"

Building and linking lua from source via makefile

I've tried to compile and link lua with my application. This is my makefile:
app.o: app.cpp
g++ -c app.cpp
PATH_LUA=../lua-5.4.3/src
LUA= \
$(PATH_LUA)/lapi.c \
$(PATH_LUA)/lauxlib.c \
$(PATH_LUA)/lbaselib.c \
$(PATH_LUA)/lcode.c \
$(PATH_LUA)/lcorolib.c \
$(PATH_LUA)/lctype.c \
$(PATH_LUA)/ldblib.c \
$(PATH_LUA)/ldebug.c \
$(PATH_LUA)/ldo.c \
$(PATH_LUA)/ldump.c \
$(PATH_LUA)/lfunc.c \
$(PATH_LUA)/lgc.c \
$(PATH_LUA)/linit.c \
$(PATH_LUA)/liolib.c \
$(PATH_LUA)/llex.c \
$(PATH_LUA)/lmathlib.c \
$(PATH_LUA)/lmem.c \
$(PATH_LUA)/loadlib.c \
$(PATH_LUA)/lobject.c \
$(PATH_LUA)/lopcodes.c \
$(PATH_LUA)/loslib.c \
$(PATH_LUA)/lparser.c \
$(PATH_LUA)/lstate.c \
$(PATH_LUA)/lstring.c \
$(PATH_LUA)/lstrlib.c \
$(PATH_LUA)/ltable.c \
$(PATH_LUA)/ltablib.c \
$(PATH_LUA)/ltm.c \
$(PATH_LUA)/lundump.c \
$(PATH_LUA)/lutf8lib.c \
$(PATH_LUA)/lvm.c \
$(PATH_LUA)/lzio.c
libLua.so:
g++ -shared $(LUA) -fPIC -o lua/libLua.so
all: libLua.so app.o
g++ -o app app.o -I$(PATH_LUA) -lLua -Llua -ldl
The compilation works fine, but something is wrong with the linkage, because I get tons of undefined references to "lua_XYZ-function". The undefined reference to lua_tointegerx for example makes no sense, since its implementation is located in lapi.c which is in the file-list above.
(INB4: "This is a duplicate question!" … I've tried my best to check them all.)
What am I missing?
You are putting the libLua.so (by the way, personally I think it's a really bad idea to name your library the same name as the standard library, just uppercase... there's no way that can't bite you or someone in the rear at some point) in the lua subdirectory but you don't tell the linker where to find it.
Then, you list liblua.a as the prerequisite, but you have no actual rule to build liblua.a, which means make will come up with one based on its internal rules... whatever rule it uses will certainly not include all your source files (how could it know?).
If you show us the actual output of running make (before all the error messages) it should be pretty clear this has gone wrong from the beginning.
Speaking from a strictly makefile perspective, it's virtually always wrong to have the name of the file your recipe builds be different than the name of the target in the makefile.
You have to compile lua as c++-code explicitly.
You do this by including
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
instead of
#include <lua.hpp> which includes that extern "C" {...} statement.

Wispr-Location-Id and Wispr-Location-Name saved when accounting

I have several Hotspots around the city, each one with different Wispr-Location-Id and Wispr-Location-Name. All these Hotspots use the same Radius server and share the same database.
Is there any way when accounting message is received to save this two parameters (Wispr-Location-Id and Wispr-Location-Name)
I need to know which clients roams from one Hotspot to another.
Thanks!
You'll need to edit the queries specific to your database dialect:
They can be found at /etc/(raddb|freeradius)/sql/<dialect>/dialup.conf
https://github.com/FreeRADIUS/freeradius-server/blob/v2.x.x/raddb/sql/mysql/dialup.conf#L163
You'll need to add the additional fields and values to the following queries:
- accounting_start_query
- accounting_stop_query
- accounting_stop_query_alt
an example of a modified accounting_start_query for MySQL would be:
accounting_start_query = " \
INSERT INTO ${acct_table1} \
(acctsessionid, acctuniqueid, username, \
realm, nasipaddress, nasportid, \
nasporttype, acctstarttime, acctstoptime, \
acctsessiontime, acctauthentic, connectinfo_start, \
connectinfo_stop, acctinputoctets, acctoutputoctets, \
calledstationid, callingstationid, acctterminatecause, \
servicetype, framedprotocol, framedipaddress, \
acctstartdelay, acctstopdelay, xascendsessionsvrkey,
wisprlocationid, wisprlocationname) \
VALUES \
('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', \
'%{SQL-User-Name}', \
'%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', \
'%{NAS-Port-Type}', '%S', NULL, \
'0', '%{Acct-Authentic}', '%{Connect-Info}', \
'', '0', '0', \
'%{Called-Station-Id}', '%{Calling-Station-Id}', '', \
'%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', \
'%{%{Acct-Delay-Time}:-0}', '0', '%{X-Ascend-Session-Svr-Key}',\
'%{WISPR-Location-Name}', '%{WISPR-Location-ID}')"
You'll also need to add additional string type columns in the radacct table to hold the additional values.

Could not reload changes to file [C:\...\UserController.groovy]: Cannot get property 'instanceControllerTagLibraryApi' on null object

Use:
-Windows 8
-Intellij IDEA 14.14
-grails 2.5.1
-JDK 8u51
*** Using IntelliJ IDEA:
1) I think new project
2) I use a simple controller: "User" properly "String name"
3) Run the application
3) I do make this easy modification to the controller: When I create a new User should show "Hello!" on the console.
4) After changing me it appears on the console:
"08/04/2015 12: 43: 51.315 [Thread-9] ERROR plugins.AbstractGrailsPluginManager - Plugin [controllers: 2.5.1] Could not reload Changes to file [C: \ Users \ Ivan Velazquez \ IdeaProjects \ Demo \ grails- app \ controllers \ demo \ UserController.groovy]: Can not get property 'instanceControllerTagLibraryApi' on null object "
5) No changes were made, obviously, when I create a new User no "Hello!" on the console.
*** Using the Windows console:
The error is different:
"08/04/2015 12: 43: 51.315 [Thread-9] ERROR plugins.AbstractGrailsPluginManager - Plugin [controllers: 2.5.1] Could not reload Changes to file [C: \ Users \ Ivan Velazquez \ IdeaProjects \ Demo \ grails- app \ controllers \ demo \ UserController.groovy]: Can not invoke method getPropertyValue () on null object "
I searched the error in several forums but can not find solution.
Thank You!
This is a bug for Windows + Grails, it thinks that it fails to reload the controller if you make changes to it. In most cases, the controller has actually updated and reloaded, but it still shows an error. If you have problems, you can restart the grails server to see your changes.

Resources