Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcarfixers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobin
dcarfixers
Commits
7a1742e9
Commit
7a1742e9
authored
Aug 06, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vin audit changes
parent
839b0156
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
14 deletions
+20
-14
Product.php
application/controllers/Product.php
+5
-2
Vehicle.php
application/controllers/Vehicle.php
+1
-1
Product_model.php
application/models/Product_model.php
+8
-8
addproduct.php
application/views/Product/addproduct.php
+4
-2
custom-script.js
assets/js/custom-script.js
+2
-1
No files found.
application/controllers/Product.php
View file @
7a1742e9
...
...
@@ -24,6 +24,7 @@ class Product extends CI_Controller {
$template
[
'product_data'
]
=
$this
->
Product_model
->
getProduct
();
$template
[
'veh_data'
][
'make'
]
=
$this
->
Vehicle_model
->
getVehBrand
(
''
,
1
);
$template
[
'veh_data'
][
'model'
]
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
);
//pr($template['veh_data']['model']);
$template
[
'brand_data'
]
=
$this
->
Brand_model
->
getbrand
(
''
,
1
);
$this
->
load
->
view
(
'template'
,
$template
);
}
...
...
@@ -85,7 +86,7 @@ class Product extends CI_Controller {
redirect
(
base_url
(
'Product/addproduct'
));
}
$_POST
[
'created_by'
]
=
(
$this
->
session
->
userdata
[
'user_type'
]
==
2
)
?
$this
->
session
->
userdata
[
'id'
]
:
0
;
pr
(
$_POST
);
//
pr($_POST);
$product_id
=
$this
->
Product_model
->
addProduct
(
$_POST
);
if
(
$product_id
){
$evtMediaData
=
array
();
...
...
@@ -135,8 +136,9 @@ class Product extends CI_Controller {
$template
[
'product_id'
]
=
encode_param
(
$product_id
);
$template
[
'brand_data'
]
=
$this
->
Brand_model
->
getbrand
(
''
,
1
);
$template
[
'product_data'
]
=
$this
->
Product_model
->
getProduct
(
$product_id
);
pr
(
$template
[
'product_data'
])
;
//echo "<pre>"; print_r($template['product_data']) ; exit
;
$template
[
'veh_data'
][
'make'
]
=
$this
->
Vehicle_model
->
getVehBrand
(
''
,
1
);
$template
[
'veh_data'
][
'model'
]
=
$this
->
Vehicle_model
->
getVehModel
(
''
,
1
);
$template
[
'product_image'
]
=
$this
->
Product_model
->
getProductImage
(
$product_id
);
$template
[
'brand_id'
]
=
$template
[
'product_data'
]
->
brand_id
;
$this
->
load
->
view
(
'template'
,
$template
);
...
...
@@ -181,6 +183,7 @@ class Product extends CI_Controller {
$existingImages
=
(
isset
(
$_POST
[
'existingImages'
])
&&
!
empty
(
$_POST
[
'existingImages'
]))
?
$_POST
[
'existingImages'
]
:
''
;
unset
(
$_POST
[
'existingImages'
]);
//pr($_POST);
$product
=
$this
->
Product_model
->
updateProduct
(
decode_param
(
$product_id
),
$_POST
);
if
(
$product
){
$evtMediaData
=
array
();
...
...
application/controllers/Vehicle.php
View file @
7a1742e9
...
...
@@ -366,7 +366,7 @@ class Vehicle extends CI_Controller {
continue
;
}
$modArr
[]
=
$model
->
model
;
$results
.=
'<option value="'
.
$model
->
veh_model_id
.
'" model="'
.
$model
->
model
.
'">'
;
$results
.=
'<option value="'
.
$model
->
veh_model_id
.
'"
vehicle_id="'
.
$model
->
veh_id
.
'"
model="'
.
$model
->
model
.
'">'
;
$results
.=
$model
->
model
;
if
(
$type
==
0
){
$results
.=
(
!
empty
(
$model
->
trim
))
?
' '
.
$model
->
trim
:
''
;
...
...
application/models/Product_model.php
View file @
7a1742e9
...
...
@@ -11,12 +11,12 @@ class Product_model extends CI_Model {
}
$prdYear
=
$product_data
[
'prdVehYear'
];
$prdVehModel
=
$product_data
[
'prdVehModel'
];
unset
(
$product_data
[
'prdVehModel'
],
$product_data
[
'prdVehYear'
],
$product_data
[
'vehModel'
]);
$prdVehicle_id
=
$product_data
[
'prdVehicle_id'
];
unset
(
$product_data
[
'prdVehModel'
],
$product_data
[
'prdVehYear'
],
$product_data
[
'vehModel'
]
,
$product_data
[
'prdVehicle_id'
]
);
$status
=
$this
->
db
->
insert
(
'products'
,
$product_data
);
$last_id
=
$this
->
db
->
insert_id
();
foreach
(
$prdYear
as
$key
=>
$value
)
{
$this
->
db
->
insert
(
'product_cars'
,
array
(
'product_id'
=>
$last_id
,
'veh_model_id'
=>
$prdVeh
Model
[
$key
]));
$this
->
db
->
insert
(
'product_cars'
,
array
(
'product_id'
=>
$last_id
,
'veh_model_id'
=>
$prdVeh
icle_id
[
$key
]));
}
return
$last_id
;
}
...
...
@@ -34,12 +34,12 @@ class Product_model extends CI_Model {
if
(
!
empty
(
$product_id
)){
$result
=
$result
->
row
();
$sql
=
"SELECT PC.prd_car_id,
PC
.year,VM.model_name as model,VEH.trim,VEH.engine,VB.maker,VM.veh_model_id,VEH.veh_id
$sql
=
"SELECT PC.prd_car_id,
VEH
.year,VM.model_name as model,VEH.trim,VEH.engine,VB.maker,VM.veh_model_id,VEH.veh_id
FROM products AS PRD
LEFT JOIN product_cars AS PC ON (PRD.product_id=PC.product_id AND PC.status='1')
LEFT JOIN vehicles AS VEH ON (PC.veh_model_id=VEH.veh_id AND VEH.status='1')
LEFT JOIN vehicle
s_model AS VM ON (VM.veh_model_id=VEH.veh
_id AND VM.status='1')
LEFT JOIN vehicles_brand AS VB ON (VB.veh_brand_id=V
M
.veh_brand_id AND VB.status='1')
LEFT JOIN vehicle
_models AS VM ON (VM.veh_model_id=VEH.model
_id AND VM.status='1')
LEFT JOIN vehicles_brand AS VB ON (VB.veh_brand_id=V
EH
.veh_brand_id AND VB.status='1')
WHERE PC.product_id='
$product_id
' AND PRD.status='1'"
;
$carData
=
$this
->
db
->
query
(
$sql
);
$carData
=
(
!
empty
(
$carData
))
?
$carData
->
result
()
:
[];
...
...
@@ -64,9 +64,9 @@ class Product_model extends CI_Model {
}
$this
->
db
->
delete
(
'product_cars'
,
array
(
'product_id'
=>
$product_id
));
foreach
(
$product_data
[
'prdVehYear'
]
as
$key
=>
$value
)
{
$this
->
db
->
insert
(
'product_cars'
,
array
(
'product_id'
=>
$product_id
,
'veh_model_id'
=>
$product_data
[
'prdVeh
Model'
][
$key
],
'year'
=>
$value
));
$this
->
db
->
insert
(
'product_cars'
,
array
(
'product_id'
=>
$product_id
,
'veh_model_id'
=>
$product_data
[
'prdVeh
icle_id'
][
$key
]
));
}
unset
(
$product_data
[
'prdVehModel'
],
$product_data
[
'prdVehYear'
],
$product_data
[
'vehModel'
]);
unset
(
$product_data
[
'prdVehModel'
],
$product_data
[
'prdVehYear'
],
$product_data
[
'vehModel'
]
,
$product_data
[
'prdVehicle_id'
]
);
$status
=
$this
->
db
->
update
(
'products'
,
$product_data
,
array
(
'product_id'
=>
$product_id
));
return
(
$status
)
?
1
:
0
;
}
...
...
application/views/Product/addproduct.php
View file @
7a1742e9
<div
class=
"content-wrapper"
>
<section
class=
"content-header"
>
<h1>
<?=
$pTitle
?>
<small>
<?=
$pDescription
?>
</small>
...
...
@@ -166,7 +167,7 @@
!
empty
(
$product_data
->
veh_model_id
)
&&
$product_data
->
veh_model_id
==
$value
->
veh_model_id
)
?
'selected'
:
''
;
echo
'<option '
.
$cond
.
' value="'
.
$value
->
veh_model_id
.
'">'
.
$value
->
model
.
' '
.
$value
->
trim
.
' '
.
$value
->
engine
.
'</option>'
;
echo
'<option '
.
$cond
.
' value="'
.
$value
->
veh_model_id
.
'"
vehicle_id="'
.
$value
->
veh_id
.
'"
>'
.
$value
->
model
.
' '
.
$value
->
trim
.
' '
.
$value
->
engine
.
'</option>'
;
}
}
?>
...
...
@@ -210,7 +211,8 @@
</div>
</div>
<input
type=
"hidden"
value=
"
<?=
$value
->
year
?>
"
name=
"prdVehYear[]"
>
<input
type=
"hidden"
value=
"
<?=
$value
->
veh_id
?>
"
name=
"prdVehModel[]"
>
<input
type=
"hidden"
value=
"
<?=
$value
->
veh_model_id
?>
"
name=
"prdVehModel[]"
>
<input
type=
"hidden"
value=
"
<?=
$value
->
veh_id
?>
"
name=
"prdVehicle_id[]"
>
</span>
</div>
<?php
...
...
assets/js/custom-script.js
View file @
7a1742e9
...
...
@@ -591,7 +591,7 @@ jQuery('[id^="addPrdtCar"]').on('click',function(event) {
model
=
jQuery
(
"#veh_model option:selected"
).
text
(),
modelVal
=
jQuery
(
"#veh_model"
).
val
(),
count
=
parseInt
((
jQuery
(
this
).
attr
(
'count'
)))
+
1
;
vehicle_id
=
jQuery
(
'[name="vehModel"] option:selected'
).
attr
(
'vehicle_id'
),
jQuery
(
this
).
attr
(
'count'
,
count
);
if
(
year
==
''
||
year
==
null
||
year
==
'null'
||
year
==
undefined
||
year
==
'undefined'
||
model
==
''
||
model
==
null
||
model
==
'null'
||
model
==
undefined
||
model
==
'undefined'
||
make
==
''
||
make
==
null
||
make
==
'null'
||
make
==
undefined
||
make
==
'undefined'
||
count
==
''
||
count
==
null
||
count
==
'null'
||
count
==
undefined
||
count
==
'undefined'
||
modelVal
==
''
||
modelVal
==
null
||
modelVal
==
'null'
||
modelVal
==
undefined
||
modelVal
==
'undefined'
){
return
false
;
...
...
@@ -603,6 +603,7 @@ jQuery('[id^="addPrdtCar"]').on('click',function(event) {
'</div>'
+
'<input type="hidden" value="'
+
year
+
'" name="prdVehYear[]">'
+
'<input type="hidden" value="'
+
modelVal
+
'" name="prdVehModel[]">'
+
'<input type="hidden" value="'
+
vehicle_id
+
'" name="prdVehicle_id[]">'
+
'</span>'
;
jQuery
(
'[id="addCarResult"]'
).
append
(
'<div id="add_result_'
+
count
+
'" class="col-md-6 form-group">'
+
vehHtmlBody
+
'</div>'
);
jQuery
(
'[id="addCarResult"]'
).
removeClass
(
'hide'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment